blob: dea6fb3278fdb3a02553d6df32ecfb25b54c0891 (
plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{
lib,
flake-parts-lib,
...
}:
let
inherit (lib) mkOption mkEnableOption types;
inherit (flake-parts-lib) mkPerSystemOption;
in {
# imports = [
# ./qmk.nix
# ];
options.perSystem = mkPerSystemOption ({ pkgs, system, config, ... }: {
options.devices = mkOption {
default = {};
type = types.lazyAttrsOf <| types.submoduleWith {
shorthandOnlyDefinesConfig = true;
modules = [
{
_module.args = {
inherit pkgs lib;
};
}
({ name, ... }: {
# _module.args = {
# inherit pkgs lib flake-parts-lib;
# };
options = {
enable = mkEnableOption name // { default = true; };
type = mkOption {
type = types.enum [ ];
description = ''
Firmware type. Extensible for other firmwares.
'';
};
build = {
flash = mkOption {
type = types.package;
description = ''
Flash script
'';
};
};
};
})
./qmk.nix
];
};
};
# config._type = "submodule";
# };
# };
# };
config = {
packages = config.devices |> lib.filterAttrs (_: v: v.enable) |> builtins.mapAttrs (_: v: v.build.flash);
};
});
}
|