1let
2 # The warning is in a top-level let binding so it is only printed once.
3 minimalModulesWarning = warn "lib.nixos.evalModules is experimental and subject to change. See nixos/lib/default.nix" null;
4 inherit (nonExtendedLib) warn;
5 nonExtendedLib = import ../../lib;
6in
7{ # Optional. Allows an extended `lib` to be used instead of the regular Nixpkgs lib.
8 lib ? nonExtendedLib,
9
10 # Feature flags allow you to opt in to unfinished code. These may change some
11 # behavior or disable warnings.
12 featureFlags ? {},
13
14 # This file itself is rather new, so we accept unknown parameters to be forward
15 # compatible. This is generally not recommended, because typos go undetected.
16 ...
17}:
18let
19 seqIf = cond: if cond then builtins.seq else a: b: b;
20 # If cond, force `a` before returning any attr
21 seqAttrsIf = cond: a: lib.mapAttrs (_: v: seqIf cond a v);
22
23 eval-config-minimal = import ./eval-config-minimal.nix { inherit lib; };
24
25 testing-lib = import ./testing/default.nix { inherit lib; };
26in
27/*
28 This attribute set appears as lib.nixos in the flake, or can be imported
29 using a binding like `nixosLib = import (nixpkgs + "/nixos/lib") { }`.
30*/
31{
32 inherit (seqAttrsIf (!featureFlags?minimalModules) minimalModulesWarning eval-config-minimal)
33 evalModules
34 ;
35
36 inherit (testing-lib)
37 evalTest
38 runTest
39 ;
40
41}