diff options
author | Mathijs Kwik <mathijs@bluescreen303.nl> | 2014-12-16 17:07:14 +0100 |
---|---|---|
committer | Mathijs Kwik <mathijs@bluescreen303.nl> | 2014-12-16 19:13:15 +0100 |
commit | 73f18fd42f6d266f586c4b80b596a0f761a904df (patch) | |
tree | 233e56b7fec3f3c24b55bc322f219dec09fb0be8 /nixos/lib | |
parent | 8bfd6af9ed0eb774035431dab663ee131941a971 (diff) |
nixos: allow adding extra modules through environment
This is useful for adding extra functionality or defaults to _every_
nixos evaluation.
My use case is overriding behaviour for all nixos tests, for example
setting packageOverrides to newer versions and changing some default
dependencies/settings.
By making this accessible through an environment variable, this can now
be fully accomplished externally. No more need to fork
nixos/nixpkgs (which becomes a maintenance burden), just use the channel
instead and plug in via this envvar.
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/eval-config.nix | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 0fa00637a93a..08adcf3a0078 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -11,15 +11,16 @@ , prefix ? [] }: -let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in - -rec { +let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; + extraModules = let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH"; + in if e == "" then [] else [(import (builtins.toPath e))]; +in rec { # Merge the option definitions in all modules, forming the full # system configuration. inherit (pkgs.lib.evalModules { inherit prefix; - modules = modules ++ baseModules; + modules = modules ++ extraModules ++ baseModules; args = extraArgs; check = check && options.environment.checkConfigurationOptions.value; }) config options; |