-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.nix
131 lines (131 loc) · 5.25 KB
/
site.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
localFlake:
let
lib = localFlake.lib;
provision-nix-local = {
mdbook.src = ./.;
homepage = {
url = "http://localhost:8937";
body = "Homepage";
};
docgen.scripts.hostOptions =
(lib.evalModules {
modules = [ (import ./scripts/submodule.nix localFlake) ];
}).options;
docgen.scripts-flake.filter =
option:
builtins.elemAt option.loc 0 == "perSystem"
&& builtins.length option.loc > 1
&& builtins.elemAt option.loc 1 == "scripts";
docgen.scripts-flake.hostOptions =
(localFlake.flake-parts-lib.evalFlakeModule { inputs.self = localFlake.self; } {
imports = [ localFlake.self.flakeModules.scripts ];
systems = [
(throw "The `systems` option value is not available when generating documentation. This is generally caused by a missing `defaultText` on one or more options in the trace. Please run this evaluation with `--show-trace`, look for `while evaluating the default value of option` and add a `defaultText` to the one or more of the options involved.")
];
}).options;
docgen.scripts-nixos.filter =
option: builtins.elemAt option.loc 0 == "provision" && builtins.elemAt option.loc 1 == "scripts";
docgen.scripts-home.hostOptions =
(lib.evalModules {
modules = [
(import ./scripts/homeModule.nix localFlake)
{ options.home.packages = lib.mkOption { default = { }; }; }
];
}).options;
docgen.scripts-home.filter =
option: builtins.elemAt option.loc 0 == "provision" && builtins.elemAt option.loc 1 == "scripts";
docgen.flake-all = {
hostOptions =
(localFlake.flake-parts-lib.evalFlakeModule { inputs.self = localFlake.self; } {
imports = [
localFlake.self.auto-import.flake.modules.auto-import
localFlake.self.auto-import.flake.modules.channels
localFlake.self.auto-import.flake.modules.docs
localFlake.self.auto-import.flake.modules.hosts
localFlake.self.auto-import.flake.modules.lib
localFlake.self.auto-import.flake.modules.nuscht-search
localFlake.self.auto-import.flake.modules.packagesGroups
localFlake.self.auto-import.flake.modules.profiles
localFlake.self.auto-import.flake.modules.scripts
localFlake.self.auto-import.flake.modules.provision-shells
];
systems = [
(throw "The `systems` option value is not available when generating documentation. This is generally caused by a missing `defaultText` on one or more options in the trace. Please run this evaluation with `--show-trace`, look for `while evaluating the default value of option` and add a `defaultText` to the one or more of the options involved.")
];
}).options;
filter =
option:
let
flakeEnabled = (builtins.elemAt option.loc 0 == "flake" && builtins.length option.loc > 1);
perSystemEnabled = (builtins.elemAt option.loc 0 == "perSystem" && builtins.length option.loc > 1);
loc1 = name: builtins.elemAt option.loc 1 == name;
in
(
flakeEnabled
&& (
(loc1 "docs")
|| (loc1 "hosts")
|| (loc1 "lib")
|| (loc1 "profiles")
|| (loc1 "auto-import")
|| (loc1 "scripts")
|| (loc1 "__provision")
)
)
|| (
perSystemEnabled
&& (
(loc1 "channels")
|| (loc1 "nuscht-search")
|| (loc1 "packagesGroups")
|| (loc1 "provision")
|| (loc1 "scripts")
|| (loc1 "sites")
)
);
};
docgen.nixos-all.filter =
option:
builtins.elemAt option.loc 0 == "provision"
|| (
builtins.elemAt option.loc 0 == "networking"
&& builtins.elemAt option.loc 1 == "nftables"
&& builtins.elemAt option.loc 2 == "gen"
);
docgen.nixos-nftables.filter =
option:
builtins.elemAt option.loc 0 == "networking"
&& builtins.elemAt option.loc 1 == "nftables"
&& builtins.elemAt option.loc 2 == "gen";
};
in
{
flake.docs = {
enable = true;
defaults = {
nuscht-search.baseHref = "/search/";
nuscht-search.title = "Provision Nix Options Search";
nuscht-search.customTheme = ./docs/theme/css/nuscht-search.css;
hostOptions = localFlake.self.nixosConfigurations.basic.options;
substitution.outPath = localFlake.self.outPath;
# substitution.gitRepoFilePath = "https://github.com/kraftnix/provision-nix";
substitution.gitRepoUrl = "https://gitea.home.lan/kraftnix/provision-nix";
# substitution.gitRepoFilePath = "https://github.com/kraftnix/provision-nix/tree/master/";
substitution.gitRepoFilePath = "https://gitea.home.lan/kraftnix/provision-nix/src/branch/master/";
};
sites = {
inherit provision-nix-local;
provision-nix = lib.mkMerge [
provision-nix-local
{
homepage = lib.mkForce {
url = "https://kraftnix.dev";
body = "Homepage";
siteBase = "/projects/provision-nix/";
};
defaults.substitution.gitRepoUrl = lib.mkForce "https://github.com/kraftnix/provision-nix";
}
];
};
};
}