forked from LnL7/nix-darwin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval-config.nix
51 lines (42 loc) · 1.45 KB
/
eval-config.nix
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ lib }:
{ system ? builtins.currentSystem or "x86_64-darwin"
, modules
, inputs
, baseModules ? import ./modules/module-list.nix
, specialArgs ? { }
}@args:
let
inputsModule = {
_file = ./eval-config.nix;
config = {
_module.args.inputs = inputs;
};
};
pkgsModule = { config, inputs, ... }: {
_file = ./eval-config.nix;
config = {
_module.args.pkgs = import inputs.nixpkgs config.nixpkgs;
# This permits the configuration to override the passed-in
# system.
nixpkgs.system = lib.mkDefault system;
};
};
libExtended = lib.extend (self: super: {
# Added in nixpkgs #136909, adds forward compatibility until 22.03 is deprecated.
literalExpression = super.literalExpression or super.literalExample;
literalDocBook = super.literalDocBook or super.literalExample;
});
eval = libExtended.evalModules (builtins.removeAttrs args [ "inputs" "system" ] // {
modules = modules ++ [ inputsModule pkgsModule ] ++ baseModules;
args = { inherit baseModules modules; };
specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs;
});
# Was moved in nixpkgs #82751, so both need to be handled here until 20.03 is deprecated.
# https://github.com/NixOS/nixpkgs/commits/dcdd232939232d04c1132b4cc242dd3dac44be8c
_module = eval._module or eval.config._module;
in
{
inherit (_module.args) pkgs;
inherit (eval) options config;
system = eval.config.system.build.toplevel;
}