blob: f53fd8ca14dfdc5a24113b065a64d2c0013fc580 (
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
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
|
{
config,
lib,
...
}: let
inherit (lib) mkOption types mkIf;
cnf = config.cynerd.hosts;
staticZoneOption = mkOption {
type = types.attrsOf types.str;
readOnly = true;
description = "The mapping of zone hosts to their IP";
};
in {
options = {
cynerd.hosts = {
enable = mkOption {
type = types.bool;
default = true;
description = "Use my personal static hosts";
};
vpn = staticZoneOption;
wg = staticZoneOption;
spt = staticZoneOption;
adm = staticZoneOption;
};
};
config = {
cynerd.hosts = {
vpn = {
"lipwig" = "10.8.0.1";
"adm-omnia" = "10.8.0.51";
};
wg = {
"lipwig" = "10.8.1.1";
# Portable
"binky" = "10.8.1.10";
"android" = "10.8.1.30";
# Endpoints
"spt-omnia" = "10.8.1.50";
"adm-omnia" = "10.8.1.51";
# Endpoints without routing
"dean" = "10.8.1.59";
};
spt = {
# Network
"omnia" = "10.8.2.1";
"mox" = "10.8.2.2";
"mox2" = "10.8.2.3";
# Local
"mpd" = "10.8.2.51";
"errol" = "10.8.2.60";
"printer" = "10.8.2.90";
# Portable
"albert" = "10.8.2.61";
"binky" = "10.8.2.63";
};
adm = {
# Network
"omnia" = "10.8.3.1";
"omnia2" = "10.8.3.3";
# Local
"ridcully" = "10.8.3.60";
"3dprint" = "10.8.3.80";
"mpd" = "10.8.3.51";
"printer" = "192.168.0.20";
# Portable
"albert" = "10.8.3.61";
"binky" = "10.8.3.63";
};
};
networking.hosts = mkIf cnf.enable {
# VPN
"${cnf.vpn.lipwig}" = ["lipwig.vpn"];
"${cnf.vpn.adm-omnia}" = ["adm.vpn"];
# Wireguard
"${cnf.wg.lipwig}" = ["lipwig.wg"];
"${cnf.wg.binky}" = ["binky.wg"];
"${cnf.wg.android}" = ["android.wg"];
"${cnf.wg.spt-omnia}" = ["spt.wg"];
"${cnf.wg.adm-omnia}" = ["adm.wg"];
"${cnf.wg.dean}" = ["dean" "dean.wg"];
# Spt
"${cnf.spt.omnia}" = ["omnia.spt"];
"${cnf.spt.mox}" = ["mox.spt"];
"${cnf.spt.mox2}" = ["mox2.spt"];
"10.8.2.4" = ["mi3g.spt"];
"${cnf.spt.mpd}" = ["mpd.spt"];
"${cnf.spt.errol}" = ["errol" "desktop.spt"];
"${cnf.spt.albert}" = ["albert.spt"];
"${cnf.spt.binky}" = ["binky.spt"];
# Adm
"${cnf.adm.omnia}" = ["omnia.adm"];
"10.8.3.2" = ["redmi.adm"];
"${cnf.adm.omnia2}" = ["omnia2.adm"];
"${cnf.adm.ridcully}" = ["ridcully" "desktop.adm"];
"${cnf.adm.albert}" = ["albert.adm"];
"${cnf.adm.binky}" = ["binky.adm"];
"${cnf.adm."3dprint"}" = ["3dprint"];
"${cnf.adm.mpd}" = ["mpd.adm"];
};
};
}
|