nix: fix generation of nix.conf for nix >= 2.20

(cherry picked from commit 880d9bc211)
This commit is contained in:
Ramses 2024-02-03 11:14:20 +01:00 committed by Graham Christensen
parent 652fda4ca6
commit f33900124c

View file

@ -52,13 +52,17 @@ let
checkPhase =
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 ${
${cfg.package}/bin/nix ${showCommand} ${
optionalString (isNixAtLeast "2.3pre")
"--no-net --option experimental-features nix-command"
} \