diff options
Diffstat (limited to 'hosts/vidhar/printing/default.nix')
-rw-r--r-- | hosts/vidhar/printing/default.nix | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/hosts/vidhar/printing/default.nix b/hosts/vidhar/printing/default.nix deleted file mode 100644 index 55c55b37..00000000 --- a/hosts/vidhar/printing/default.nix +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | { config, lib, ... }: | ||
2 | |||
3 | with lib; | ||
4 | |||
5 | let | ||
6 | containerConfig = config.containers.printing.config; | ||
7 | in { | ||
8 | config = { | ||
9 | containers.printing = { | ||
10 | privateNetwork = true; | ||
11 | ephemeral = true; | ||
12 | autoStart = true; | ||
13 | hostAddress = "10.141.5.0"; | ||
14 | hostAddress6 = "2a03:4000:52:ada:5::"; | ||
15 | localAddress = "10.141.5.1"; | ||
16 | localAddress6 = "2a03:4000:52:ada:5::1"; | ||
17 | interfaces = [ "printer" ]; | ||
18 | config = let | ||
19 | hostConfig = config; | ||
20 | in { ... }: { | ||
21 | config = { | ||
22 | services = { | ||
23 | kea = { | ||
24 | dhcp4 = { | ||
25 | enable = true; | ||
26 | settings = { | ||
27 | valid-lifetime = 4000; | ||
28 | rebind-timer = 2000; | ||
29 | renew-timer = 1000; | ||
30 | |||
31 | interfaces-config = { | ||
32 | interfaces = [ "printer" ]; | ||
33 | }; | ||
34 | |||
35 | lease-database = { | ||
36 | name = "/var/lib/kea/dhcp4.leases"; | ||
37 | persist = true; | ||
38 | type = "memfile"; | ||
39 | }; | ||
40 | |||
41 | subnet4 = [ | ||
42 | { subnet = "10.141.3.0/24"; | ||
43 | option-data = [ | ||
44 | { name = "domain-name-servers"; | ||
45 | data = "10.141.5.0"; | ||
46 | } | ||
47 | { name = "ntp-servers"; | ||
48 | data = "10.141.5.0"; | ||
49 | } | ||
50 | { name = "broadcast-address"; | ||
51 | data = "10.141.3.255"; | ||
52 | } | ||
53 | { name = "routers"; | ||
54 | data = "10.141.3.1"; | ||
55 | } | ||
56 | { name = "domain-name"; | ||
57 | data = "yggdrasil"; | ||
58 | } | ||
59 | { name = "domain-search"; | ||
60 | data = "printer.yggdrasil, yggdrasil"; | ||
61 | } | ||
62 | ]; | ||
63 | pools = [ { pool = "10.141.3.128 - 10.141.3.254"; } ]; | ||
64 | reservations = [ | ||
65 | { hostname = "printer"; | ||
66 | hw-address = "30:cd:a7:b0:55:8d"; | ||
67 | ip-address = "10.141.3.2"; | ||
68 | } | ||
69 | ]; | ||
70 | } | ||
71 | ]; | ||
72 | }; | ||
73 | }; | ||
74 | }; | ||
75 | |||
76 | printing = { | ||
77 | enable = true; | ||
78 | listenAddresses = [ | ||
79 | "*:631" | ||
80 | ]; | ||
81 | logLevel = "all"; | ||
82 | extraConf = mkForce '' | ||
83 | ServerName printing | ||
84 | ServerAlias 10.141.5.1 2a03:4000:52:ada:5::1 printing.vidhar.yggdrasil printing.vidhar.lan.yggdrasil | ||
85 | |||
86 | DefaultEncryption Never | ||
87 | |||
88 | <Location /> | ||
89 | Order allow,deny | ||
90 | Allow from 10.0.0.0/8 | ||
91 | Satisfy any | ||
92 | </Location> | ||
93 | |||
94 | <Location /admin> | ||
95 | Order allow,deny | ||
96 | Allow from 10.0.0.0/8 | ||
97 | Satisfy any | ||
98 | </Location> | ||
99 | |||
100 | <Location /admin/conf> | ||
101 | Order allow,deny | ||
102 | Allow from 10.0.0.0/8 | ||
103 | Satisfy any | ||
104 | </Location> | ||
105 | |||
106 | <Policy default> | ||
107 | <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job> | ||
108 | Order allow,deny | ||
109 | Allow from 10.0.0.0/8 | ||
110 | Satisfy any | ||
111 | </Limit> | ||
112 | |||
113 | <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default> | ||
114 | Order allow,deny | ||
115 | Allow from 10.0.0.0/8 | ||
116 | Satisfy any | ||
117 | </Limit> | ||
118 | |||
119 | <Limit Cancel-Job CUPS-Authenticate-Job> | ||
120 | Order allow,deny | ||
121 | Allow from 10.0.0.0/8 | ||
122 | Satisfy any | ||
123 | </Limit> | ||
124 | |||
125 | <Limit All> | ||
126 | Order allow,deny | ||
127 | Allow from 10.0.0.0/8 | ||
128 | Satisfy any | ||
129 | </Limit> | ||
130 | </Policy> | ||
131 | ''; | ||
132 | }; | ||
133 | |||
134 | resolved.enable = false; | ||
135 | }; | ||
136 | |||
137 | networking = { | ||
138 | firewall.enable = false; | ||
139 | nftables = { | ||
140 | enable = true; | ||
141 | rulesetFile = ./ruleset.nft; | ||
142 | }; | ||
143 | |||
144 | useDHCP = false; | ||
145 | useNetworkd = true; | ||
146 | |||
147 | interfaces."printer" = { | ||
148 | ipv4.addresses = [ | ||
149 | { address = "10.141.3.1"; prefixLength = 24; } | ||
150 | ]; | ||
151 | }; | ||
152 | }; | ||
153 | |||
154 | environment.etc."resolv.conf".text = '' | ||
155 | nameserver ${hostConfig.containers.printing.hostAddress6} | ||
156 | ''; | ||
157 | |||
158 | system.stateVersion = hostConfig.system.stateVersion; | ||
159 | }; | ||
160 | }; | ||
161 | }; | ||
162 | |||
163 | networking = { | ||
164 | vlans.printer = { | ||
165 | id = 5; | ||
166 | interface = "eno2"; | ||
167 | }; | ||
168 | }; | ||
169 | }; | ||
170 | } | ||