-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib.nix
41 lines (41 loc) · 1.03 KB
/
lib.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
{lib}: let
evalConfig = options: config:
let
mergedConfig = lib.evalModules {
modules = [
{ inherit options; }
{ inherit config; }
];
};
in mergedConfig;
configurableFlake = inputs:
{
options
, config ? { }
}: outputBuilder:
let mergedConfig = evalConfig options config;
withConfig = newConfig: configurableFlake inputs {
config = newConfig;
inherit options;} outputBuilder;
in
(outputBuilder (inputs // {config = mergedConfig.config;})) //
{ config = mergedConfig; inherit options withConfig;};
withSystems = inputs: systems:
let options = {
systems = lib.mkOption {
type = with lib.types; listOf (enum utils.allSystems);
default = systems;
};
};
config = {
inherit systems;
};
in
configurableFlake inputs {
inherit options config;
};
in
{
inherit configurableFlake;
inherit withSystems;
}