]> git.scottworley.com Git - auto-upgrade-with-pinch/commitdiff
Switch from 'nix eval' to 'nix-instantiate --eval'
authorScott Worley <scottworley@scottworley.com>
Fri, 29 Apr 2022 23:50:44 +0000 (16:50 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 29 Apr 2022 23:50:44 +0000 (16:50 -0700)
Nix 2.4 changed the interface to 'nix eval' so that --arg doesn't work anymore.

This is a workaround for https://github.com/NixOS/nix/issues/2678

modules/auto-upgrade.nix

index 54a30835d490a8215af0875868b921eac59d7abd..4a5aa83582e1c06fd5d1e81d89a65e0dc34cd74e 100644 (file)
@@ -144,12 +144,12 @@ let
           + concatMapStringsSep "\n" (f: "verify_ownership ${escapeShellArg f}")
           cfg.upgradeConfig)}
 
           + concatMapStringsSep "\n" (f: "verify_ownership ${escapeShellArg f}")
           cfg.upgradeConfig)}
 
-        config=$(${pkgs.nix}/bin/nix eval --json -f ${../upgrade-config.nix} \
+        config=$(${pkgs.nix}/bin/nix-instantiate --eval --strict --json -A config \
           --arg upgradeConfig ${
             escapeShellArg ("["
               + lib.concatMapStringsSep " " lib.strings.escapeNixString
               cfg.upgradeConfig + "]")
           --arg upgradeConfig ${
             escapeShellArg ("["
               + lib.concatMapStringsSep " " lib.strings.escapeNixString
               cfg.upgradeConfig + "]")
-          } config)
+          } ${../upgrade-config.nix})
 
         config_query() {
           ${pkgs.jq}/bin/jq -r "$@" <<< "$config"
 
         config_query() {
           ${pkgs.jq}/bin/jq -r "$@" <<< "$config"