diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2020-10-25 15:17:36 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2020-10-25 15:56:29 +0100 |
| commit | 74eb216078b9323e2d3061fe3c45bd2f2a633472 (patch) | |
| tree | a00534460d6e9ad168962deba4c0e2df085fdf69 /modules | |
| parent | 5dfd0c44857c32f600ea7b4e86db7377bb9d997f (diff) | |
remove nix 1.x config compatibility
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nix/default.nix | 49 | ||||
| -rw-r--r-- | modules/services/activate-system/default.nix | 5 | ||||
| -rw-r--r-- | modules/system/activation-scripts.nix | 1 |
3 files changed, 13 insertions, 42 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 72609c5..2f8f001 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -25,25 +25,18 @@ let ${optionalString cfg.useDaemon '' build-users-group = nixbld ''} - ${if isNix20 then "max-jobs" else "build-max-jobs"} = ${toString (cfg.maxJobs)} - ${if isNix20 then "cores" else "build-cores"} = ${toString (cfg.buildCores)} - ${if isNix20 then "sandbox" else "build-use-sandbox"} = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox} + max-jobs = ${toString (cfg.maxJobs)} + cores = ${toString (cfg.buildCores)} + sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox} ${optionalString (cfg.sandboxPaths != []) '' - ${if isNix20 then "extra-sandbox-paths" else "build-sandbox-paths"} = ${toString cfg.sandboxPaths} - ''} - ${if isNix20 then "substituters" else "binary-caches"} = ${toString cfg.binaryCaches} - ${if isNix20 then "trusted-substituters" else "trusted-binary-caches"} = ${toString cfg.trustedBinaryCaches} - ${if isNix20 then "trusted-public-keys" else "binary-cache-public-keys"} = ${toString cfg.binaryCachePublicKeys} - ${if isNix20 then '' - require-sigs = ${if cfg.requireSignedBinaryCaches then "true" else "false"} - '' else '' - signed-binary-caches = ${if cfg.requireSignedBinaryCaches then "*" else ""} + extra-sandbox-paths = ${toString cfg.sandboxPaths} ''} + substituters = ${toString cfg.binaryCaches} + trusted-substituters = ${toString cfg.trustedBinaryCaches} + trusted-public-keys = ${toString cfg.binaryCachePublicKeys} + require-sigs = ${if cfg.requireSignedBinaryCaches then "true" else "false"} trusted-users = ${toString cfg.trustedUsers} allowed-users = ${toString cfg.allowedUsers} - ${optionalString (isNix20 && !cfg.distributedBuilds) '' - builders = - ''} $extraOptions END ''; @@ -410,25 +403,7 @@ in ) cfg.buildMachines; }; - nix.envVars = - optionalAttrs (!isNix20) { - NIX_CONF_DIR = "/etc/nix"; - - # Enable the copy-from-other-stores substituter, which allows - # builds to be sped up by copying build results from remote - # Nix stores. To do this, mount the remote file system on a - # subdirectory of /run/nix/remote-stores. - NIX_OTHER_STORES = "/run/nix/remote-stores/*/nix"; - } - // optionalAttrs cfg.distributedBuilds { - NIX_CURRENT_LOAD = "/run/nix/current-load"; - } - // optionalAttrs (cfg.distributedBuilds && !isNix20) { - NIX_BUILD_HOOK = "${cfg.package}/libexec/nix/build-remote.pl"; - NIX_REMOTE_SYSTEMS = "/etc/nix/machines"; - }; - - environment.extraInit = optionalString (!isNix20) '' + environment.extraInit = '' # Set up secure multi-user builds: non-root users build through the # Nix daemon. if [ ! -w /nix/var/nix/db ]; then @@ -441,12 +416,6 @@ in { NIX_PATH = concatStringsSep ":" cfg.nixPath; }; - system.activationScripts.nix.text = mkIf cfg.distributedBuilds '' - if [ ! -d ${cfg.envVars.NIX_CURRENT_LOAD} ]; then - mkdir -p ${cfg.envVars.NIX_CURRENT_LOAD} - fi - ''; - system.activationScripts.nix-daemon.text = mkIf cfg.useDaemon '' if ! diff /etc/nix/nix.conf /run/current-system/etc/nix/nix.conf &> /dev/null; then echo "reloading nix-daemon..." >&2 diff --git a/modules/services/activate-system/default.nix b/modules/services/activate-system/default.nix index bf2a5d2..f8b3043 100644 --- a/modules/services/activate-system/default.nix +++ b/modules/services/activate-system/default.nix @@ -21,6 +21,10 @@ in launchd.daemons.activate-system = { script = '' + set -e + set -o pipefail + export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin" + # Make this configuration the current configuration. # The readlink is there to ensure that when $systemConfig = /system # (which is a symlink to the store), /run/current-system is still @@ -31,7 +35,6 @@ in ln -sfn /run/current-system /nix/var/nix/gcroots/current-system ${config.system.activationScripts.keyboard.text} - ${config.system.activationScripts.nix.text} ''; serviceConfig.RunAtLoad = true; serviceConfig.KeepAlive.SuccessfulExit = false; diff --git a/modules/system/activation-scripts.nix b/modules/system/activation-scripts.nix index bbbda88..a9aac25 100644 --- a/modules/system/activation-scripts.nix +++ b/modules/system/activation-scripts.nix @@ -55,7 +55,6 @@ in ${cfg.activationScripts.extraActivation.text} ${cfg.activationScripts.groups.text} ${cfg.activationScripts.users.text} - ${cfg.activationScripts.nix.text} ${cfg.activationScripts.applications.text} ${cfg.activationScripts.patches.text} ${cfg.activationScripts.etc.text} |
