1# DO NOT IMPORT. Use nixpkgsFlake.lib.nixos, or import (nixpkgs + "/nixos/lib")
2{ lib }: # read -^
3
4let
5
6 /*
7 Invoke NixOS. Unlike traditional NixOS, this does not include all modules.
8 Any such modules have to be explicitly added via the `modules` parameter,
9 or imported using `imports` in a module.
10
11 A minimal module list improves NixOS evaluation performance and allows
12 modules to be independently usable, supporting new use cases.
13
14 Parameters:
15
16 modules: A list of modules that constitute the configuration.
17
18 specialArgs: An attribute set of module arguments. Unlike
19 `config._module.args`, these are available for use in
20 `imports`.
21 `config._module.args` should be preferred when possible.
22
23 Return:
24
25 An attribute set containing `config.system.build.toplevel` among other
26 attributes. See `lib.evalModules` in the Nixpkgs library.
27 */
28 evalModules =
29 {
30 prefix ? [ ],
31 modules ? [ ],
32 specialArgs ? { },
33 }:
34 # NOTE: Regular NixOS currently does use this function! Don't break it!
35 # Ideally we don't diverge, unless we learn that we should.
36 # In other words, only the public interface of nixos.evalModules
37 # is experimental.
38 lib.evalModules {
39 inherit prefix modules;
40 class = "nixos";
41 specialArgs = {
42 modulesPath = builtins.toString ../modules;
43 }
44 // specialArgs;
45 };
46
47in
48{
49 inherit evalModules;
50}