From e05e5e8a51db2e7c60a352e90295e0820983579e Mon Sep 17 00:00:00 2001 From: Don Harper Date: Mon, 12 Jan 2026 23:49:49 -0600 Subject: [PATCH] hosts | refactoring. --- hosts/{server => common}/tailscale.nix | 0 .../{workstation => common}/upgrade-diff.nix | 0 hosts/server/default.nix | 4 +- hosts/server/upgrade-diff.nix | 8 ---- hosts/workstation/default.nix | 4 +- hosts/workstation/tailscale.nix | 39 ------------------- 6 files changed, 4 insertions(+), 51 deletions(-) rename hosts/{server => common}/tailscale.nix (100%) rename hosts/{workstation => common}/upgrade-diff.nix (100%) delete mode 100644 hosts/server/upgrade-diff.nix delete mode 100644 hosts/workstation/tailscale.nix diff --git a/hosts/server/tailscale.nix b/hosts/common/tailscale.nix similarity index 100% rename from hosts/server/tailscale.nix rename to hosts/common/tailscale.nix diff --git a/hosts/workstation/upgrade-diff.nix b/hosts/common/upgrade-diff.nix similarity index 100% rename from hosts/workstation/upgrade-diff.nix rename to hosts/common/upgrade-diff.nix diff --git a/hosts/server/default.nix b/hosts/server/default.nix index 97a6b27..8e8750e 100644 --- a/hosts/server/default.nix +++ b/hosts/server/default.nix @@ -37,8 +37,8 @@ in { ../vars.nix ./systemd.nix ../systemd-primary.nix - # ./tailscale.nix - ./upgrade-diff.nix + # ../comon/tailscale.nix + ../common/upgrade-diff.nix ../../modules/beszel-agent.nix ]; diff --git a/hosts/server/upgrade-diff.nix b/hosts/server/upgrade-diff.nix deleted file mode 100644 index a74504e..0000000 --- a/hosts/server/upgrade-diff.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: { - stdenv.hostPlatform.system.activationScripts.diff = { - supportsDryActivation = true; - text = '' - ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" - ''; - }; -} diff --git a/hosts/workstation/default.nix b/hosts/workstation/default.nix index 2fba195..3c46a57 100644 --- a/hosts/workstation/default.nix +++ b/hosts/workstation/default.nix @@ -34,7 +34,7 @@ in { }; imports = [ inputs.catppuccin.nixosModules.catppuccin - # ./tailscale.nix + # ../comon/tailscale.nix ../../home ../../home/gui ../../home/gui/gnome-calenar.nix @@ -52,7 +52,7 @@ in { ../systemd-primary.nix ./auto-cpufreq.nix ./tlp.nix - ./upgrade-diff.nix + ../common/upgrade-diff.nix ./wine.nix ]; diff --git a/hosts/workstation/tailscale.nix b/hosts/workstation/tailscale.nix deleted file mode 100644 index 99afd9b..0000000 --- a/hosts/workstation/tailscale.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - inputs, - outputs, - lib, - config, - pkgs, - ... -}: { - systemd = { - services = { - tailscale-autoconnect = { - description = "Automatic connection to Tailscale"; - - # make sure tailscale is running before trying to connect to tailscale - after = ["network-pre.target" "tailscale.service"]; - wants = ["network-pre.target" "tailscale.service"]; - wantedBy = ["multi-user.target"]; - - # set this service as a oneshot job - serviceConfig.Type = "oneshot"; - - # have the job run this shell script - script = with pkgs; '' - # wait for tailscaled to settle - sleep 2 - - # check if we are already authenticated to tailscale - status="$(${tailscale}/bin/tailscale status -json | ${jq}/bin/jq -r .BackendState)" - if [ $status = "Running" ]; then # if so, then do nothing - exit 0 - fi - - # otherwise authenticate with tailscale - ${tailscale}/bin/tailscale up --operator=don --authkey $(cat ${config.sops.secrets."tailscale/ts_api".path}) - ''; - }; - }; - }; -}