From 58b248367c993effcd811793c9c4f4b5fb94c0cb Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 7 Jul 2024 20:10:54 -0400 Subject: [PATCH] nixosModules: move tailscale config to hosts --- hosts/common.nix | 12 +++++++++++- hosts/fallarbor/default.nix | 2 -- hosts/lavaridge/default.nix | 5 +---- hosts/mandarin/default.nix | 5 +---- hosts/mauville/default.nix | 2 -- hosts/petalburg/default.nix | 5 +---- hosts/rustboro/default.nix | 7 +------ nixosModules/options.nix | 2 -- nixosModules/services/default.nix | 1 - nixosModules/services/tailscale/default.nix | 15 --------------- 10 files changed, 15 insertions(+), 41 deletions(-) delete mode 100644 nixosModules/services/tailscale/default.nix diff --git a/hosts/common.nix b/hosts/common.nix index e63127b9..df934752 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -4,7 +4,11 @@ pkgs, ... }: { - age.secrets.wifi.file = ../secrets/wifi.age; + age.secrets = { + tailscaleAuthKey.file = ../secrets/tailscale/authKeyFile.age; + wifi.file = ../secrets/wifi.age; + }; + environment.variables.FLAKE = "github:alyraffauf/nixcfg"; fileSystems = lib.attrsets.optionalAttrs (config.networking.hostName != "mauville") { @@ -118,4 +122,10 @@ }; }; }; + + services.tailscale = { + enable = true; + openFirewall = true; + authKeyFile = config.age.secrets.tailscaleAuthKey.path; + }; } diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index 1c858ccb..8e8b9f2d 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -39,8 +39,6 @@ enable = true; syncMusic = false; }; - - tailscale.enable = true; }; users = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 0ab91320..ad01336f 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -44,10 +44,7 @@ hyprland.enable = true; }; - services = { - syncthing.enable = true; - tailscale.enable = true; - }; + services.syncthing.enable = true; users.aly = { enable = true; diff --git a/hosts/mandarin/default.nix b/hosts/mandarin/default.nix index d604be5a..504c03dc 100644 --- a/hosts/mandarin/default.nix +++ b/hosts/mandarin/default.nix @@ -58,10 +58,7 @@ steam.enable = true; }; - services = { - flatpak.enable = true; - tailscale.enable = true; - }; + services.flatpak.enable = true; users = { aly = { diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 275f6331..2717201a 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -136,8 +136,6 @@ in { syncMusic = true; musicPath = "${mediaDirectory}/Music"; }; - - tailscale.enable = true; }; }; diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index 6a12724b..86c6cf79 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -42,10 +42,7 @@ hyprland.enable = true; }; - services = { - syncthing.enable = true; - tailscale.enable = true; - }; + services.syncthing.enable = true; users.aly = { enable = true; diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index c1444427..944915cd 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -20,9 +20,7 @@ }; networking.hostName = "rustboro"; - system.stateVersion = "24.05"; - zramSwap.memoryPercent = 100; ar = { @@ -41,10 +39,7 @@ hyprland.enable = true; }; - services = { - syncthing.enable = true; - tailscale.enable = true; - }; + services.syncthing.enable = true; users.aly = { enable = true; diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 4337c320..dc9e6f8e 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -67,8 +67,6 @@ type = lib.types.str; }; }; - - tailscale.enable = lib.mkEnableOption "Tailscale WireGuard VPN."; }; }; } diff --git a/nixosModules/services/default.nix b/nixosModules/services/default.nix index 3fb69937..aff2fdc2 100644 --- a/nixosModules/services/default.nix +++ b/nixosModules/services/default.nix @@ -7,6 +7,5 @@ imports = [ ./flatpak ./syncthing - ./tailscale ]; } diff --git a/nixosModules/services/tailscale/default.nix b/nixosModules/services/tailscale/default.nix deleted file mode 100644 index 5e697f2d..00000000 --- a/nixosModules/services/tailscale/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: { - config = lib.mkIf config.ar.services.tailscale.enable { - age.secrets.tailscaleAuthKey.file = ../../../secrets/tailscale/authKeyFile.age; - services.tailscale = { - enable = true; - openFirewall = true; - authKeyFile = config.age.secrets.tailscaleAuthKey.path; - }; - }; -}