anchor.diff:          }
         ]
   
  -      ++ optional (config.nix.distributedBuilds && !config.nix.manualNixMachines)
  +      ++ optional (cfg.distributedBuilds && !cfg.manualNixMachines)
           { # List of machines for distributed Nix builds in the format expected
             # by build-remote.pl.
             source = pkgs.writeText "nix.machines"
  
positive.code:               + " ${machine.sshKey} ${toString machine.maxJobs} "
                + (if machine ? speedFactor then toString machine.speedFactor else "1" )
                + "\n"
              ) config.nix.buildMachines));
            target = "nix.machines";
          };
  
      jobs.nixDaemon =
        { name = "nix-daemon";
  
          startOn = "startup";
  
          path = [ nix pkgs.openssl pkgs.utillinux ]
            ++ optionals config.nix.distributedBuilds [ pkgs.openssh pkgs.gzip ];
  
          script =
            ''
              ${config.nix.envVars}
              exec \
                nice -n ${builtins.toString config.nix.daemonNiceLevel} \
                ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \
                nix-worker --daemon > /dev/null 2>&1
            '';
  
          extraConfig =
            ''
              limit nofile 4096 4096
            '';
        };
  
      environment.shellInit =
        ''
          # Set up the environment variables for running Nix.
          ${config.nix.envVars}
  
          # Set up secure multi-user builds: non-root users build through the
          # Nix daemon.
  
negative.code:               # /bin/sh won't work.
                binshDeps = pkgs.writeReferencesToFile config.system.build.binsh;
              in
                pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
                  extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
                  cat > $out <<END
                  # WARNING: this file is generated.
                  build-users-group = nixbld
                  build-max-jobs = ${toString (cfg.maxJobs)}
                  build-use-chroot = ${if cfg.useChroot then "true" else "false"}
                  build-chroot-dirs = ${toString cfg.chrootDirs} $(echo $extraPaths)
                  $extraOptions
                  END
                '';
  