diff options
author | Will Dietz <github@wdtz.org> | 2018-05-01 16:09:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-01 16:09:20 -0500 |
commit | fdc581d8c3f9f52d987fb0c85c799dde8b794387 (patch) | |
tree | 648e0dbb29042bbc2ce0f9f27a9934819fdfcb99 | |
parent | e9be7fcb002c2b40e6f36f71ecade51ee9ef09e5 (diff) | |
parent | fa1d1eec6e5ef9f248416bec9df10ee2c9ed0e15 (diff) | |
download | nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar.gz nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar.bz2 nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar.lz nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar.xz nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.tar.zst nixlib-fdc581d8c3f9f52d987fb0c85c799dde8b794387.zip |
Merge pull request #39407 from dtzWill/feature/check-nix.conf
nixos/nix-daemon: optionally (on by default) check nix.conf can be read
-rw-r--r-- | nixos/modules/services/misc/nix-daemon.nix | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index f2d34560a718..9c428d7a422d 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -33,7 +33,7 @@ let sh = pkgs.runtimeShell; binshDeps = pkgs.writeReferencesToFile sh; in - pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } '' + pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } ('' ${optionalString (!isNix20) '' extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done) ''} @@ -62,7 +62,11 @@ let ''} $extraOptions 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 @@ -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. + ''; + }; }; }; |