anchor.diff:          mkdir -p /var/samba/locks /var/samba/cores/nmbd  /var/samba/cores/smbd /var/samba/cores/winbindd
         fi
   
  -      passwdFile="$(sed -n 's/^.*smb[ ]\+passwd[ ]\+file[ ]\+=[ ]\+\(.*\)/\1/p' ${configFile})"
  +      passwdFile="$(${pkgs.gnused}/bin/sed -n 's/^.*smb[ ]\+passwd[ ]\+file[ ]\+=[ ]\+\(.*\)/\1/p' ${configFile})"
         if [ -n "$passwdFile" ]; then
  -        echo 'INFO: creating directory containing passwd file'
  +        echo 'INFO: [samba] creating directory containing passwd file'
           mkdir -p "$(dirname "$passwdFile")"
         fi
   
         mkdir -p ${logDir}
         mkdir -p ${privateDir}
  -
  -      # The following line is to trigger a restart of the daemons when
  -      # the configuration changes:
  -      # ${configFile}
       '';
   
     configFile = pkgs.writeText "smb.conf"
  
positive.code:           };
  
  
          # Dummy job to start the real Samba daemons (nmbd, smbd, winbindd).
          jobs.sambaControl =
            { name = "samba";
              description = "Samba server";
  
              startOn = "started network-interfaces";
              stopOn = "stopping network-interfaces";
  
              preStart = setupScript;
            };
  
          jobs.nmbd = daemonJob "nmbd" "-D";
  
          jobs.smbd = daemonJob "smbd" "-D";
  
          jobs.winbindd = daemonJob "winbindd" "-D";
        })
      ];
  
  
negative.code:   # This may include nss_ldap, needed for samba if it has to use ldap.
    nssModulesPath = config.system.nssModules.path;
  
    daemonService = appName: args:
      { description = "Samba Service daemon ${appName}";
  
        wantedBy = [ "samba.target" ];
        partOf = [ "samba.target" ];
  
        environment = {
          LD_LIBRARY_PATH = nssModulesPath;
  