anchor.diff:          LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
         };
   
  -      daemonType = "fork";
  -
  -      exec = "${samba}/sbin/${appName} ${args}";
  +      serviceConfig = {
  +        ExecStart = "${samba}/sbin/${appName} ${args}";
  +        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
  +      };
  +
  +      restartTriggers = [ configFile ];
       };
   
   in
  
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:         mkdir -p /var/samba/locks /var/samba/cores/nmbd  /var/samba/cores/smbd /var/samba/cores/winbindd
        fi
  
        passwdFile="$(${pkgs.gnused}/bin/sed -n 's/^.*smb[ ]\+passwd[ ]\+file[ ]\+=[ ]\+\(.*\)/\1/p' ${configFile})"
        if [ -n "$passwdFile" ]; then
          echo 'INFO: [samba] creating directory containing passwd file'
          mkdir -p "$(dirname "$passwdFile")"
        fi
  
        mkdir -p ${logDir}
        mkdir -p ${privateDir}
      '';
  
    configFile = pkgs.writeText "smb.conf"
  