mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 06:31:02 +00:00
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.
This commit is contained in:
parent
8bfd6af9ed
commit
73f18fd42f
|
@ -11,15 +11,16 @@
|
||||||
, prefix ? []
|
, prefix ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
|
let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system;
|
||||||
|
extraModules = let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH";
|
||||||
rec {
|
in if e == "" then [] else [(import (builtins.toPath e))];
|
||||||
|
in rec {
|
||||||
|
|
||||||
# Merge the option definitions in all modules, forming the full
|
# Merge the option definitions in all modules, forming the full
|
||||||
# system configuration.
|
# system configuration.
|
||||||
inherit (pkgs.lib.evalModules {
|
inherit (pkgs.lib.evalModules {
|
||||||
inherit prefix;
|
inherit prefix;
|
||||||
modules = modules ++ baseModules;
|
modules = modules ++ extraModules ++ baseModules;
|
||||||
args = extraArgs;
|
args = extraArgs;
|
||||||
check = check && options.environment.checkConfigurationOptions.value;
|
check = check && options.environment.checkConfigurationOptions.value;
|
||||||
}) config options;
|
}) config options;
|
||||||
|
|
Loading…
Reference in a new issue