|
8 | 8 | docs = |
9 | 9 | pkgs.runCommand "docs" |
10 | 10 | { |
| 11 | + passthru.json = |
| 12 | + pkgs.runCommand "docs-json" |
| 13 | + { |
| 14 | + buildInputs = [ pkgs.jq ]; |
| 15 | + hosts = pkgs.writeText "hosts.json" ( |
| 16 | + builtins.toJSON ( |
| 17 | + pkgs.lib.mapAttrs (_: x: { |
| 18 | + experimental-features = x.config.nix.settings.experimental-features or [ ]; |
| 19 | + extra-platforms = x.config.nix.settings.extra-platforms or [ ]; |
| 20 | + system-features = x.config.nix.settings.system-features or [ ]; |
| 21 | + inherit (x.pkgs.stdenv.hostPlatform) system; |
| 22 | + inherit (x.config.nix.settings) sandbox; |
| 23 | + }) (self.darwinConfigurations // self.nixosConfigurations) |
| 24 | + ) |
| 25 | + ); |
| 26 | + } |
| 27 | + '' |
| 28 | + mkdir -p $out |
| 29 | + for host in $(jq -r 'keys[]' $hosts); do |
| 30 | + jq --arg host "$host" \ |
| 31 | + '.[$host] | walk(if type == "array" then sort else . end)' \ |
| 32 | + --sort-keys < $hosts > $out/$host.json |
| 33 | + done |
| 34 | + ''; |
11 | 35 | buildInputs = [ |
12 | 36 | pkgs.python3.pkgs.mkdocs-material |
13 | 37 | pkgs.python3.pkgs.mkdocs-redirects |
|
22 | 46 | } |
23 | 47 | '' |
24 | 48 | cp --no-preserve=mode -r $files/* . |
25 | | - cp --no-preserve=mode ${config.packages.docs-json}/*.json docs |
| 49 | + cp --no-preserve=mode ${config.packages.docs.json}/*.json docs |
26 | 50 | mkdocs build --strict --site-dir $out |
27 | 51 | ''; |
28 | | - docs-json = |
29 | | - pkgs.runCommand "docs-json" |
30 | | - { |
31 | | - buildInputs = [ pkgs.jq ]; |
32 | | - hosts = pkgs.writeText "hosts.json" ( |
33 | | - builtins.toJSON ( |
34 | | - pkgs.lib.mapAttrs (_: x: { |
35 | | - experimental-features = x.config.nix.settings.experimental-features or [ ]; |
36 | | - extra-platforms = x.config.nix.settings.extra-platforms or [ ]; |
37 | | - system-features = x.config.nix.settings.system-features or [ ]; |
38 | | - inherit (x.pkgs.stdenv.hostPlatform) system; |
39 | | - inherit (x.config.nix.settings) sandbox; |
40 | | - }) (self.darwinConfigurations // self.nixosConfigurations) |
41 | | - ) |
42 | | - ); |
43 | | - } |
44 | | - '' |
45 | | - mkdir -p $out |
46 | | - for host in $(jq -r 'keys[]' $hosts); do |
47 | | - jq --arg host "$host" \ |
48 | | - '.[$host] | walk(if type == "array" then sort else . end)' \ |
49 | | - --sort-keys < $hosts > $out/$host.json |
50 | | - done |
51 | | - ''; |
52 | 52 | }; |
53 | 53 | }; |
54 | 54 | } |
0 commit comments