about summary refs log tree commit diff
path: root/modules/profiles
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-05 14:21:01 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-05 14:21:01 +0100
commit44ffb85896ae518a46c08608e7f1879ec4a5ee4e (patch)
tree33d9e626871ab0bff092d6904dd2d2116ecdf0e0 /modules/profiles
parente79e71de5c6c9a3d22105646b64c5a8bbee7616b (diff)
profiles/common: Add NIXPKGS_CONFIG env variable.
Having <nixpkgs-config> in PATH doesn't help in anything if we actually
forget to add the right environment variable where we import the
<nixpkgs-config> from NIX_PATH.

The reason why I choose to use <nixpkgs-config> instead of directly
specifying the config in NIXPKGS_CONFIG is that we now have _one_
environment variable (NIX_PATH) to override everything from the
<nixpkgs> version to its config.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules/profiles')
-rw-r--r--modules/profiles/common.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/profiles/common.nix b/modules/profiles/common.nix
index 0be2be96..39535d4f 100644
--- a/modules/profiles/common.nix
+++ b/modules/profiles/common.nix
@@ -56,6 +56,14 @@ with lib;
       "headcounter.org:/7YANMvnQnyvcVB6rgFTdb8p5LG1OTXaO+21CaOSBzg="
     ];
 
+    environment.variables.NIXPKGS_CONFIG = let
+      nixpkgsCfg = toString (pkgs.writeText "nixpkgs-try-config.nix" ''
+        if (builtins.tryEval <nixpkgs-config>).success
+        then import <nixpkgs-config>
+        else {}
+      '');
+    in mkIf config.vuizvui.enableGlobalNixpkgsConfig (mkForce nixpkgsCfg);
+
     nix.nixPath = let
       nixpkgs = import ../../nixpkgs-path.nix;
       rootChannelsPath = "/nix/var/nix/profiles/per-user/root/channels";