Merge pull request #39407 from dtzWill/feature/check-nix.conf
nixos/nix-daemon: optionally (on by default) check nix.conf can be read
This commit is contained in:
commit
fdc581d8c3
|
@ -33,7 +33,7 @@ let
|
||||||
sh = pkgs.runtimeShell;
|
sh = pkgs.runtimeShell;
|
||||||
binshDeps = pkgs.writeReferencesToFile sh;
|
binshDeps = pkgs.writeReferencesToFile sh;
|
||||||
in
|
in
|
||||||
pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } ''
|
pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } (''
|
||||||
${optionalString (!isNix20) ''
|
${optionalString (!isNix20) ''
|
||||||
extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
|
extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
|
||||||
''}
|
''}
|
||||||
|
@ -62,7 +62,11 @@ let
|
||||||
''}
|
''}
|
||||||
$extraOptions
|
$extraOptions
|
||||||
END
|
END
|
||||||
'';
|
'' + optionalString cfg.checkConfig ''
|
||||||
|
echo "Checking that Nix can read nix.conf..."
|
||||||
|
ln -s $out ./nix.conf
|
||||||
|
NIX_CONF_DIR=$PWD ${cfg.package}/bin/nix show-config >/dev/null
|
||||||
|
'');
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -349,6 +353,13 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
checkConfig = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
If enabled (the default), checks that Nix can parse the generated nix.conf.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue