diff options
author | Mathijs Kwik <mathijs@bluescreen303.nl> | 2012-07-21 17:35:50 +0200 |
---|---|---|
committer | Mathijs Kwik <mathijs@bluescreen303.nl> | 2012-07-21 17:35:50 +0200 |
commit | b609ff4fcf48b2124d94bf1052c303a36c8cabf1 (patch) | |
tree | c9b3cef625dccf14d51a32f1188d7803690c3739 /default.nix | |
parent | 63742a942e5cbf1d254f89506b382a0524237a3a (diff) |
allow out-of-tree nixos modules
The environment variable "NIXOS_EXTRA_MODULES" is now checked to
contain a path to a file similar to modules/module-list.nix.
This gives the ability to include nixos modules that are not in the
nixos source tree.
This can be useful for modules that are still experimental, or which
aren't useful for other nixos users. Of course, this was already
possible to do this using a forked nixos tree, but with this
functionality, you can just rely on the nixos channel, easing things a
lot.
Diffstat (limited to '')
-rw-r--r-- | default.nix | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/default.nix b/default.nix index fda19c3a149..ca69f07ef31 100644 --- a/default.nix +++ b/default.nix @@ -1,12 +1,15 @@ { configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config> +, extraModulesPath ? builtins.getEnv "NIXOS_EXTRA_MODULES" , system ? builtins.currentSystem }: let + extraModules = if extraModulesPath == "" then [] else import extraModulesPath; + eval = import ./lib/eval-config.nix { inherit system; - modules = [ configuration ]; + modules = [ configuration ] ++ extraModules; }; inherit (eval) config pkgs; @@ -14,7 +17,7 @@ let # This is for `nixos-rebuild build-vm'. vmConfig = (import ./lib/eval-config.nix { inherit system; - modules = [ configuration ./modules/virtualisation/qemu-vm.nix ]; + modules = [ configuration ./modules/virtualisation/qemu-vm.nix ] ++ extraModules; }).config; # This is for `nixos-rebuild build-vm-with-bootloader'. @@ -24,7 +27,7 @@ let [ configuration ./modules/virtualisation/qemu-vm.nix { virtualisation.useBootLoader = true; } - ]; + ] ++ extraModules; }).config; in |