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:   # This may include nss_ldap, needed for samba if it has to use ldap.
    nssModulesPath = config.system.nssModules.path;
  
    daemonJob = appName: args:
      { name = "samba-${appName}";
        description = "Samba Service daemon ${appName}";
  
        startOn = "started samba";
        stopOn = "stopping samba";
  
        environment = {
          LD_LIBRARY_PATH = nssModulesPath;
  
negative.code:         LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
        };
  
        serviceConfig = {
          ExecStart = "${samba}/sbin/${appName} ${args}";
          ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        };
  
        restartTriggers = [ configFile ];
      };
  
  in
  