summary refs log tree commit diff
path: root/pkgs/build-support/usernixos/eval-config.nix
blob: 300ddd2444e52bbc1d19e2e8619eb810ddef2420 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ system ? builtins.currentSystem
, pkgs ? null
, baseModules ? import ./module-list.nix
, extraArgs ? {}
, modules
}:

let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in

rec {

  # These are the NixOS modules that constitute the system configuration.
  configComponents = modules ++ baseModules;

  # Merge the option definitions in all modules, forming the full
  # system configuration.  It's not checked for undeclared options.
  systemModule =
    pkgs.lib.fixMergeModules configComponents extraArgs;

  optionDefinitions = systemModule.config;
  optionDeclarations = systemModule.options;
  inherit (systemModule) options;

  # These are the extra arguments passed to every module.  In
  # particular, Nixpkgs is passed through the "pkgs" argument.
  extraArgs = extraArgs_ // {
    inherit pkgs modules baseModules;
  };

  config = systemModule.config;
}