blob: a6d88ccbc186b4a852c44f2be57cb73112c99ba6 (
plain) (
blame)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
lib:
with lib;
(evalModules {
modules = [
{
options.configurations = mkOption {
description = "My configurations.";
type = with types;
attrsOf (submodule ({name, ...}: {
freeformType = attrs;
options = let
mkConfigurationTypeOption = type:
mkOption {
description = "Whether the machine is a ${type} one.";
type = bool;
default = false;
};
in {
hostname = mkOption {
description = "The machine's hostname";
type = str;
default = name;
readOnly = true;
};
system = mkOption {
description = "The machine's system";
type = enum ["x86_64-linux" "aarch64-linux"];
default = "x86_64-linux";
};
isHeadless = mkConfigurationTypeOption "headless";
isHeadful = mkConfigurationTypeOption "headful";
isOther = mkConfigurationTypeOption "other";
ipv4 = {
address = mkOption {
description = "The machine's public IPv4 addresses.";
type = nullOr str;
default = null;
};
gateway = mkOption {
description = "The machine's IPv4 gateway.";
type = nullOr str;
default = null;
};
};
ipv6 = {
address = mkOption {
description = "The machine's public IPv6 addresses.";
type = nullOr str;
default = null;
};
gateway = mkOption {
description = "The machine's IPv6 gateway.";
type = nullOr str;
default = null;
};
};
wireguard = {
ipv4.address = mkOption {
description = "The machine's internal IPv4 addresses.";
type = nullOr str;
default = null;
};
ipv6.address = mkOption {
description = "The machine's internal IPv4 addresses.";
type = nullOr str;
default = null;
};
publicKey = mkOption {
description = "The machine's public key.";
type = nullOr str;
default = null;
};
};
# TODO Automate filling of this from the NSD service module.
# Right now I need to copy domain defenitions from there to here
# manually.
#
# Something like taking `config.services.nsd.zones[$domain]` and
# filtering for actual subdomains. We can remove this option
# altogether then.
domains = mkOption {
description = "External domains that resovle to this address.";
type = listOf str;
default = [];
};
syncthing.id = mkOption {
description = "Syncthing ID.";
type = nullOr str;
default = null;
};
};
}));
default = {};
};
config = {
_module.freeformType = types.attrs;
fullname = "Azat Bahawi";
username = "azahi";
domain = {
azahi = "azahi.cc";
rohan = "rohan.net";
gondor = "gondor.net";
shire = "shire.me";
};
email = "frodo@${my.domain.gondor}";
pgp = {
key = "@PGP_KEY@";
fingerprint = "@PGP_FINGERPRINT@";
grip = "@PGP_GRIP@";
};
ssh = rec {
type = "ed25519";
id = my.email;
key = "ssh-${type} @PUBLIC_KEY@ ${id}";
};
hashedPassword = "@HASHED_PASSWORD@";
configurations = {
manwe = {
isHeadless = true;
ipv4 = {
address = "@IPV4_ADDRESS@";
gateway = "@IPV4_ADDRESS@";
};
ipv6 = {
address = "@IPV6_ADDRESS@]";
gateway = "@IPV6_ADDRESS@";
};
wireguard = {
ipv4.address = "10.69.0.1";
ipv6.address = "fd69::0:1";
publicKey = "@PUBLIC_KEY@";
};
domains = with my.domain; [
"alertmanager.${shire}"
"frodo.${rohan}"
"frodo.${gondor}"
"gotify.${shire}"
"grafana.${shire}"
"loki.${shire}"
"prometheus.${shire}"
"radicale.${shire}"
"rss-bridge.${shire}"
"vaultwarden.${shire}"
azahi
rohan
gondor
shire
];
};
varda = {
isHeadless = true;
ipv4 = {
address = "@IPV4_ADDRESS@";
gateway = "@IPV4_ADDRESS@";
};
ipv6 = {
address = "@IPV6_ADDRESS@";
gateway = "@IPV6_ADDRESS@";
};
wireguard = {
ipv4.address = "10.69.1.1";
ipv6.address = "fd69::1:1";
publicKey = "@PUBLIC_KEY@";
};
domains = with my.domain; ["minecraft.${shire}"];
};
yavanna = {
isHeadless = true;
ipv4 = {
address = "@IPV4_ADDRESS@";
gateway = "@IPV4_ADDRESS@";
};
ipv6 = {
address = "@IPV6_ADDRESS@";
gateway = "@IPV6_ADDRESS@";
};
wireguard = {
ipv4.address = "10.69.1.2";
ipv6.address = "fd69::1:2";
publicKey = "@PUBLIC_KEY@";
};
domains = with my.domain; ["flood.${shire}"];
syncthing.id = "@SYNCTHING_ID@";
};
melian = {
isHeadful = true;
wireguard = {
ipv4.address = "10.69.4.1";
ipv6.address = "fd69::4:1";
publicKey = "@PUBLIC_KEY@";
};
syncthing.id = "@SYNCTHING_ID@";
};
gothmog = {
isOther = true;
wireguard = {
ipv4.address = "10.69.5.1";
ipv6.address = "fd69::5:1";
publicKey = "@PUBLIC_KEY@";
};
syncthing.id = "@SYNCTHING_ID@";
};
};
};
}
];
})
.config
|