blob: bdf42357211be61fc6535868084197d7f638cd18 (
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
66
67
|
{
config,
lib,
withSystem,
inputs,
...
}: let
namespace = "openWrtImages";
cfg = config.${namespace};
inherit
(lib)
literalExpression
mdDoc
mkOption
types
;
openWrtSubmodule = {
freeformType = types.attrsOf types.anything;
options = {
profile = mkOption {
type = types.str;
example = literalExpression "netgear_wac104";
description = mdDoc ''
Device profile to build images for.
'';
};
release = mkOption {
type = types.str;
default = "23.05.0";
example = literalExpression "23.05.2";
description = mdDoc ''
OpenWRT release to base image off of
'';
};
};
};
in {
options.${namespace} = mkOption {
type = types.attrsOf (types.submodule openWrtSubmodule);
default = {};
description = mdDoc ''
Generated OpenWRT images
'';
};
config.flake.legacyPackages.x86_64-linux = {
${namespace} = withSystem "x86_64-linux" (
{pkgs, ...}: let
profileFromRelease = release:
(inputs.openwrt-imagebuilder.lib.profiles {
inherit pkgs release;
})
.identifyProfile;
mkImage = {profile, ...} @ args:
inputs.openwrt-imagebuilder.lib.build (
profileFromRelease args.release profile
// builtins.removeAttrs args ["profile" "release"]
);
in
lib.mapAttrs (lib.const mkImage) cfg
);
};
}
|