forked from Tow-Boot/Tow-Boot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkconfig.nix
48 lines (44 loc) · 1.09 KB
/
kconfig.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
{ config, lib, ... }:
let
inherit (lib)
mkOption
types
;
in
{
options = {
Tow-Boot = {
config = mkOption {
type = with types; listOf (functionTo attrs);
description = ''
Functions returning structured config.
The functions take one argument, an attrset of helpers.
These helpers are expected to be used with `with`, they
provide the `yes`, `no`, `whenOlder` and similar helpers
from `lib.kernel`.
The `whenHelpers` are configured with the appropriate
version already.
'';
};
structuredConfigHelper = mkOption {
internal = true;
type = types.unspecified;
description = ''
Partially applied helper to use the KConfig-compatible structured config.
'';
};
};
};
config = {
Tow-Boot = {
structuredConfigHelper =
version:
let
helpers = lib.kernel // (lib.kernel.whenHelpers version);
in
lib.mkMerge
(map (fn: fn helpers) config.Tow-Boot.config)
;
};
};
}