nixpkgs/default.nix
Mathijs Kwik b609ff4fcf 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.
2012-07-21 17:35:50 +02:00

50 lines
1.2 KiB
Nix

{ 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 ] ++ extraModules;
};
inherit (eval) config pkgs;
# This is for `nixos-rebuild build-vm'.
vmConfig = (import ./lib/eval-config.nix {
inherit system;
modules = [ configuration ./modules/virtualisation/qemu-vm.nix ] ++ extraModules;
}).config;
# This is for `nixos-rebuild build-vm-with-bootloader'.
vmWithBootLoaderConfig = (import ./lib/eval-config.nix {
inherit system;
modules =
[ configuration
./modules/virtualisation/qemu-vm.nix
{ virtualisation.useBootLoader = true; }
] ++ extraModules;
}).config;
in
{
inherit eval config;
system = config.system.build.toplevel;
vm = vmConfig.system.build.vm;
vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
# The following are used by nixos-rebuild.
nixFallback = pkgs.nixUnstable;
manifests = config.installer.manifests;
tests = config.tests;
}