Skip to content

Commit 708e7cc

Browse files
authored
Merge pull request #271423 from hercules-ci/nixos-nix.nix-nix-config-show
nixos/nix.nix: Support new Nix 2.20 command syntax
2 parents 45b9d6a + 2d0f4a7 commit 708e7cc

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nixos/modules/config/nix.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,17 @@ let
109109
if pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform then ''
110110
echo "Ignoring validation for cross-compilation"
111111
''
112-
else ''
112+
else
113+
let
114+
showCommand = if isNixAtLeast "2.20pre" then "config show" else "show-config";
115+
in
116+
''
113117
echo "Validating generated nix.conf"
114118
ln -s $out ./nix.conf
115119
set -e
116120
set +o pipefail
117121
NIX_CONF_DIR=$PWD \
118-
${cfg.package}/bin/nix show-config ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \
122+
${cfg.package}/bin/nix ${showCommand} ${optionalString (isNixAtLeast "2.3pre") "--no-net"} \
119123
${optionalString (isNixAtLeast "2.4pre") "--option experimental-features nix-command"} \
120124
|& sed -e 's/^warning:/error:/' \
121125
| (! grep '${if cfg.checkAllErrors then "^error:" else "^error: unknown setting"}')

0 commit comments

Comments
 (0)