File tree Expand file tree Collapse file tree 4 files changed +33
-15
lines changed
Expand file tree Collapse file tree 4 files changed +33
-15
lines changed Original file line number Diff line number Diff line change 4646 ## System-wide packages ##
4747 programs . nix-ld . enable = true ;
4848
49+ # VPS with limited kernel permissions; disable sandboxing
50+ nix . settings . sandbox = false ;
51+
4952 # https://wiki.nixos.org/wiki/FAQ/When_do_I_update_stateVersion
5053 system . stateVersion = "24.11" ;
5154}
Original file line number Diff line number Diff line change 1818
1919 # ── Dynamic VPN Client Discovery ──
2020 # Filter hosts that are VPN clients:
21- # - Not this host (nexus)
22- # - Has vpn config
23- # - Has endpoint set (clients connect TO a server, servers don't have endpoint )
21+ # - Not this host (nexus - the server )
22+ # - Has vpn config with publicKey
23+ # - Has a /32 address (clients have /32, server has /24 )
2424 vpnClients = lib . filterAttrs (
25- name : spec : name != host . hostName && spec . vpn or null != null && spec . vpn . endpoint or null != null
25+ name : spec :
26+ name != host . hostName
27+ && spec . vpn or null != null
28+ && spec . vpn . publicKey or null != null
29+ && lib . hasSuffix "/32" ( spec . vpn . address or "" )
2630 ) hosts ;
2731
2832 # Build peer config from host spec
5155 allowedUDPPorts = [ vpnPort ] ;
5256 # Trust the VPN interface - allow all traffic from VPN peers
5357 trustedInterfaces = [ vpnInterface ] ;
58+ # Allow rathole container (on pangolin bridge) to reach WireGuard
59+ # Docker NAT rules intercept local-destined traffic before the normal
60+ # firewall rules apply, so we need an explicit rule for br-pangolin
61+ extraInputRules = ''
62+ iifname "br-pangolin" udp dport ${ toString vpnPort } accept
63+ '' ;
5464 } ;
5565 } ;
5666}
Original file line number Diff line number Diff line change 2828 "video"
2929 "wheel"
3030 ] ;
31-
32- wgEndpoint = "pangolin.ryot.foo:51821" ;
3331 in
3432 {
3533 ## Secrets ##
115113 user = "toph" ;
116114 ip = "10.2.2.4" ;
117115 desktop = {
118- niri = {
116+ hyprland = {
119117 enable = true ;
120118 default = true ;
119+ } ;
120+ niri = {
121+ enable = true ;
121122 dms = {
122123 includeBinds = true ;
123124 includeColors = true ;
139140 tank = true ;
140141 } ;
141142 vpn = {
142- publicKey = "ECl4YWWZfuAdYesxSUOSq7mTIYwII/eYg78dLR9XpmU =" ;
143+ publicKey = "A+pF7xjkh+TcI2w9CqZydF8oRSQQxNvPpGp18/R3YCE =" ;
143144 address = "10.10.0.4/32" ;
144- endpoint = wgEndpoint ;
145145 } ;
146146 } ;
147147
152152 hyprland = {
153153 enable = true ;
154154 default = true ;
155+ dms = {
156+ sourceOutputs = true ;
157+ } ;
155158 } ;
156- niri . enable = true ;
157159 } ;
158160 greeter = {
159161 type = "dms" ;
184186 isMinimal = true ;
185187 mounts . repo = true ;
186188 vpn = {
187- publicKey = "iOSuhmjJhUcqQQBnYOs/3WSs6dyX6JnqWzZ7JbceulU =" ;
189+ publicKey = "CsFrUwKp1EQoBJqKkn44/P8q2+Zm5U0YTEpkLlrKlzI =" ;
188190 address = "10.10.0.1/24" ; # Server address
189191 # No endpoint - this is the VPN server
190192 } ;
215217 vpn = {
216218 publicKey = "9vgWTiGy9lwjXT6/hqxXNodw4jdhZPVRpbwTIWAxDWg=" ;
217219 address = "10.10.0.8/32" ;
218- endpoint = wgEndpoint ;
219220 } ;
220221 } ;
221222
224225 vpn = {
225226 publicKey = "n9EbRKf4syovfi3lnTJ7NCuywLh1IuHL7XX+wK3drUg=" ;
226227 address = "10.10.0.10/32" ;
227- endpoint = wgEndpoint ;
228228 } ;
229229 } ;
230230 } ;
Original file line number Diff line number Diff line change 2020 # Get private key for this host from secrets
2121 hostPrivateKey = secrets . service . "wg-${ host . hostName } " . privateKey or "" ;
2222
23+ # Default endpoint: use secrets.service.caenus.ip (can be overridden per-host)
24+ caelusIp = secrets . service . caenus . ip ;
25+ defaultEndpoint = "${ caelusIp } :51821" ;
26+ endpoint = if cfgWg ? endpoint && cfgWg . endpoint != null then cfgWg . endpoint else defaultEndpoint ;
27+
2328 # Allowed IP ranges for the VPN (semicolon-separated for NetworkManager)
2429 allowedIPs = lib . concatStringsSep ";" [
2530 "10.10.0.0/24" # VPN subnet (includes DNS at 10.10.0.1)
3136 ] ;
3237in
3338{
34- config = lib . mkIf ( cfgWg != null && cfgWg . endpoint != null ) {
39+ config = lib . mkIf ( cfgWg != null ) {
3540 assertions = [
3641 {
3742 assertion = nexusPublicKey != null ;
5863
5964 # Peer config - section name includes the public key
6065 "wireguard-peer.${ nexusPublicKey } " = {
61- endpoint = cfgWg . endpoint ;
66+ endpoint = endpoint ;
6267 persistent-keepalive = "25" ;
6368 allowed-ips = allowedIPs ;
6469 } ;
You can’t perform that action at this time.
0 commit comments