[Nix-dev] Samba - default configuration file location?

Marc Weber marco-oweber at gmx.de
Tue Apr 14 14:20:45 CEST 2009


Hi,

I've some trouble with the default configuration file of samba.
The derivation code states that some samba tools have to have a
configuration file.

The default has been $out/lib/smb.conf or such in the past.

However that's a problem for smbpasswd (That should'nt get its password
database file locations form the $out/lib/smb.conf, rather by a file
generated by nixos such as /etc/samba/smb.conf)

However using this different smb.conf requires you to touch the file or
NixOS to to create it on nixos-rebuild..

You don't even use the latter when only installing nix.

I'd propose this patch which allows you to override the configuration directory
with "" (so $out/lib/smb.conf is used again).

However I'd like to ask you wether you'd prefer not changing the default but wrapping
all the samba tools (such as smbpasswd) when adding them to the system path so
that smbpasswd works ?

If you don't reply I'll commit this small patch within the next days.

Are you fine with nixos creating /etc/samba/smb.cnf even when not enabling the
samba daemon only to shut up samba tools (which a user might have installed)?

Sincerly
Marc Weber

Author: Marc Weber <marco-oweber at gmx.de>  2009-04-14 14:04:36
Committer: Marc Weber <marco-oweber at gmx.de>  2009-04-14 14:12:46
Parent: eca1770dfeea6a8f8dc814c6c8d09f174d624eee (updating unifdef source location)
Branches: master, remotes/mw_int/master
Follows: 
Precedes: 

    Set more sensible default configuration file for samba (so that
    smbpasswd dosen't have to be wrapped)
    override configdir setting it to "" to get old behaviour. This is still
    useful when installing on none nixos systems or when nixos doesn't
    create that file.

------------------------ pkgs/servers/samba/default.nix ------------------------
index 0464943..e994733 100644
@@ -1,5 +1,9 @@
 { stdenv, fetchurl, readline, pam, openldap, kerberos, popt
 , iniparser, libunwind, fam, acl
+
+# set this to "" to get the old behaviour using $out/lbi/smb.conf as empty stub
+# config  to shut up programs like smbclient and smbspool
+, configdir ? "/etc/samba"
 }:
 
 stdenv.mkDerivation rec {
@@ -15,8 +19,10 @@ stdenv.mkDerivation rec {
   preConfigure = "cd source";
 
   # Provide a dummy smb.conf to shut up programs like smbclient and smbspool.
+  # as samba is used in nixos now default config location is /etc/samba now.
+  # If samba is not used by NixOS it still provides the dummy file.
   postInstall = ''
-    touch $out/lib/smb.conf
+    [ -z "$configdir"] && touch $out/lib/smb.conf
   '';
   
   configureFlags = ''

----------------------- pkgs/top-level/all-packages.nix -----------------------
index 1f2bdfe..4cbe776 100644
@@ -6668,7 +6668,7 @@ let
     inherit xmpppy python makeWrapper fetchcvs;
   };
 
-  samba = import ../servers/samba {
+  samba = makeOverridable (import ../servers/samba) {
     inherit stdenv fetchurl readline openldap pam kerberos popt iniparser
   libunwind acl fam;
   };



More information about the nix-dev mailing list