From 6668c810d3f1162584632b4dcf45770850578f6d Mon Sep 17 00:00:00 2001 From: DerGrumpf Date: Mon, 29 Jun 2026 18:13:11 +0200 Subject: [PATCH] Added Fixed Wireguard ips to hosts dns lookup --- darwin/default.nix | 18 +++++++++++++++++- darwin/wireguard.nix | 4 ++-- flake.lock | 6 +++--- nixos/default.nix | 18 ++++++++++++++---- nixos/wireguard.nix | 4 ++-- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/darwin/default.nix b/darwin/default.nix index f7109da..ff83740 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,6 +1,7 @@ { pkgs, primaryUser, + lib, ... }: { @@ -51,6 +52,12 @@ info.enable = false; # Skip info pages }; + # Mirrored Network conf + networking.knownNetworkServices = [ + "Wi-Fi" + "Ethernet" + ]; + # homebrew installation manager nix-homebrew = { user = primaryUser; @@ -60,15 +67,24 @@ # macOS-specific settings programs.fish.enable = true; - environment.shells = [ pkgs.fish ]; system.primaryUser = primaryUser; users.users.${primaryUser} = { home = "/Users/${primaryUser}"; shell = pkgs.fish; openssh.authorizedKeys.keyFiles = [ ../secrets/ssh-key ]; }; + environment = { + shells = [ pkgs.fish ]; systemPath = [ "/opt/homebrew/bin" ]; pathsToLink = [ "/Applications" ]; + etc."hosts".text = lib.mkAfter '' + 10.10.0.1 proxy.cyperpunk.de + 10.10.0.2 controller.cyperpunk.de + 10.10.0.3 mac.cyperpunk.de + 10.10.0.30 node1.cyperpunk.de + 10.10.0.31 node2.cyperpunk.de + 10.10.0.40 desktop.cyperpunk.de + ''; }; } diff --git a/darwin/wireguard.nix b/darwin/wireguard.nix index 1c523df..b4ee7ae 100644 --- a/darwin/wireguard.nix +++ b/darwin/wireguard.nix @@ -5,7 +5,7 @@ ... }: { - sops.secrets."wireguard/${hostName}" = { + sops.secrets."network/wireguard/${hostName}" = { mode = "0400"; }; @@ -13,7 +13,7 @@ script = '' set -e mkdir -p /etc/wireguard - PRIVATE_KEY=$(cat ${config.sops.secrets."wireguard/${hostName}".path}) + PRIVATE_KEY=$(cat ${config.sops.secrets."network/wireguard/${hostName}".path}) cat > /etc/wireguard/wg0.conf << EOF [Interface] Address = $WG_IP diff --git a/flake.lock b/flake.lock index c1627d2..11d0e86 100644 --- a/flake.lock +++ b/flake.lock @@ -57,11 +57,11 @@ ] }, "locked": { - "lastModified": 1781255309, - "narHash": "sha256-n2P5xkAYGylrJ3feu7L6uaCUw/+jW8rk+HO127gDbFA=", + "lastModified": 1782648384, + "narHash": "sha256-OlHdAqdXasZk1U+Zf9n+ivqHL9kj/UD0DFO4yYTNBYc=", "owner": "catppuccin", "repo": "nix", - "rev": "036c78ea4cd8a42c8546c6316a944fd7d59d4341", + "rev": "f2c7dd14ecce785c206a39466cbe227ff62e3803", "type": "github" }, "original": { diff --git a/nixos/default.nix b/nixos/default.nix index df79f08..1a39fc3 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -130,10 +130,20 @@ }; }; - networking.firewall.allowedTCPPorts = [ - 9002 - 3100 - ]; + networking = { + hosts = { + "10.10.0.1" = [ "proxy.cyperpunk.de" ]; + "10.10.0.2" = [ "controller.cyperpunk.de" ]; + "10.10.0.3" = [ "mac.cyperpunk.de" ]; + "10.10.0.30" = [ "node1.cyperpunk.de" ]; + "10.10.0.31" = [ "node2.cyperpunk.de" ]; + "10.10.0.40" = [ "desktop.cyperpunk.de" ]; + }; + firewall.allowedTCPPorts = [ + 9002 + 3100 + ]; + }; users.users.${primaryUser} = { home = "/home/${primaryUser}"; diff --git a/nixos/wireguard.nix b/nixos/wireguard.nix index 2332104..f2464ba 100644 --- a/nixos/wireguard.nix +++ b/nixos/wireguard.nix @@ -1,12 +1,12 @@ { config, hostName, ... }: { - sops.secrets."wireguard/${hostName}" = { + sops.secrets."network/wireguard/${hostName}" = { mode = "0400"; }; networking = { wireguard.interfaces.wg0 = { - privateKeyFile = config.sops.secrets."wireguard/${hostName}".path; + privateKeyFile = config.sops.secrets."network/wireguard/${hostName}".path; }; firewall.allowedUDPPorts = [ 51820 ]; };