aboutsummaryrefslogtreecommitdiff
path: root/hosts/mercury
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/mercury')
-rw-r--r--hosts/mercury/hjem.nix2
-rw-r--r--hosts/mercury/wireguard.nix21
2 files changed, 18 insertions, 5 deletions
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" = {