From 14d0c1fdf529fce896f46b651d1495288cf3013c Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Tue, 8 Sep 2026 15:37:06 -0500 Subject: random stuff --- hosts/mercury/hjem.nix | 2 +- hosts/mercury/wireguard.nix | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'hosts') diff --git a/hosts/mercury/hjem.nix b/hosts/mercury/hjem.nix index aceb772..307317a 100644 --- a/hosts/mercury/hjem.nix +++ b/hosts/mercury/hjem.nix @@ -2,7 +2,7 @@ rust-shell = let rustProfile = pkgs.buildEnv { name = "rust-profile"; - paths = with pkgs; [rustc cargo rust-analyzer]; + paths = with pkgs; [rustc cargo rust-analyzer gcc]; }; in pkgs.writeShellScriptBin "rust-shell" '' diff --git a/hosts/mercury/wireguard.nix b/hosts/mercury/wireguard.nix index 35c6a24..a103328 100644 --- a/hosts/mercury/wireguard.nix +++ b/hosts/mercury/wireguard.nix @@ -40,10 +40,23 @@ in { wantedBy = ["multi-user.target"]; after = ["network-online.target"]; wants = ["network-online.target"]; - serviceConfig = { - ExecStart = "${lib.getExe pkgs.udp2raw} -c -l 127.0.0.1:51820 -r 104.53.197.192:51843 -k shared-secret -a"; - Restart = "on-failure"; - }; + script = '' + REMOTE_IP=$(${pkgs.dnsutils}/bin/dig +short williamsfam.us.com | ${pkgs.gawk}/bin/awk 'NR==1') + + if [[ -z "$REMOTE_IP" ]]; then + echo "Failed to resolve DNS for configured domain" >&2 + exit 1 + fi + + ${lib.getExe pkgs.udp2raw} \ + -c \ + -l 127.0.0.1:51820 \ + -r "$REMOTE_IP":51843 \ + --raw-mode faketcp \ + --key "shared-secret" \ + --auto-rule + ''; + serviceConfig.Restart = "on-failure"; }; systemd.network.netdevs."10-wg" = { -- cgit v1.3.1