-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.nix
37 lines (31 loc) · 1.19 KB
/
build.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
{ lib
, linkFarm
, shajra-keyboards-builder
, shajra-keyboards-keymaps
, shajra-keyboards-licenses
}:
let
flattenBuilds = lib.concatMapAttrs (name: build: {
"${name}-flash" = build.flash;
"${name}-hex" = build.hex;
});
buildCustom = keymapsSource: id: builder:
let keymaps = shajra-keyboards-keymaps."${keymapsSource}"."${id}";
toBuild = keymap: type:
if type == "directory"
then {
"${id}-${keymapsSource}-${keymap}" = builder {
factory = false;
inherit keymap keymaps keymapsSource;
};
}
else {};
in lib.concatMapAttrs toBuild (builtins.readDir keymaps);
builds.factory =
let f = id: builder: {
"${id}-factory" = builder { factory = true; };
};
in lib.concatMapAttrs f shajra-keyboards-builder;
builds.builtin = lib.concatMapAttrs (buildCustom "builtin") shajra-keyboards-builder;
builds.input = lib.concatMapAttrs (buildCustom "input") shajra-keyboards-builder;
in flattenBuilds (lib.foldl lib.mergeAttrs {} (builtins.attrValues builds))