-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
profiles-list.nix
39 lines (33 loc) · 1018 Bytes
/
profiles-list.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
{ pkgs ? import <nixpkgs> {}
}:
let
inherit (pkgs) lib;
inherit (import ./releases.nix { inherit pkgs; }) releases;
list = release:
let
inherit (import ./profiles.nix {
inherit pkgs release;
}) allProfiles;
in pkgs.writeText "openwrt-${release}-profiles-list.md" ''
# OpenWRT ${release} profiles
${lib.concatMapStrings (target:
lib.concatMapStrings (variant: ''
## ${target}/${variant}
${lib.concatMapStrings (profile: ''
- ${profile}
'') (builtins.attrNames allProfiles.${target}.${variant}.profiles)}
'') (builtins.attrNames allProfiles.${target})
) (builtins.attrNames allProfiles)}
'';
in
pkgs.runCommand "openwrt-profiles" {
passthru = lib.listToAttrs (map (release: {
name = builtins.replaceStrings [ "." ] [ "_" ] release;
value = list release;
}) releases);
} ''
mkdir $out
${lib.concatMapStrings (release: ''
ln -s ${list release} $out/${release}.md
'') releases}
''