diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-12-05 14:47:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 14:47:20 +0100 |
commit | 708e7ccb37b9bd0631512d48398a1e82e3dc9b66 (patch) | |
tree | 15eda12c606469baab30db358ec318c719719d10 /nixos/modules/config | |
parent | 45b9d6a7c01554a3965ea9ee61ad5c03da2fbc3f (diff) | |
parent | 2d0f4a7ec19082248094eb04a35c93c94b1d35d5 (diff) |
Merge pull request #271423 from hercules-ci/nixos-nix.nix-nix-config-show
nixos/nix.nix: Support new Nix 2.20 command syntax
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/nix.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/config/nix.nix b/nixos/modules/config/nix.nix index cee4f54db0cb5..2769d8b25ef6f 100644 --- a/nixos/modules/config/nix.nix +++ b/nixos/modules/config/nix.nix @@ -109,13 +109,17 @@ let if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then '' echo "Ignoring validation for cross-compilation" '' - else '' + else + let + showCommand = if isNixAtLeast "2.20pre" then "config show" else "show-config"; + in + '' echo "Validating generated nix.conf" ln -s $out ./nix.conf set -e set +o pipefail NIX_CONF_DIR=$PWD \ - ${cfg.package}/bin/nix show-config ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \ + ${cfg.package}/bin/nix ${showCommand} ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \ ${optionalString (isNixAtLeast "2.4pre") "--option experimental-features nix-command"} \ |& sed -e 's/^warning:/error:/' \ | (! grep '${if cfg.checkAllErrors then "^error:" else "^error: unknown setting"}') |