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