From 386ecf3d14ea486aba523b14200fcd2e7e04b9d6 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Thu, 13 Feb 2025 16:54:19 -0500 Subject: nixos: make more "traits" mixins --- modules/nixos/traits/tailscale.nix | 52 -------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 modules/nixos/traits/tailscale.nix (limited to 'modules/nixos/traits/tailscale.nix') diff --git a/modules/nixos/traits/tailscale.nix b/modules/nixos/traits/tailscale.nix deleted file mode 100644 index ea38e5c..0000000 --- a/modules/nixos/traits/tailscale.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - config, - lib, - secretsDir, - ... -}: -let - cfg = config.traits.tailscale; -in -{ - options.traits.tailscale = { - enable = lib.mkEnableOption "Tailscale"; - ssh.enable = lib.mkEnableOption "Tailscale SSH"; - manageSecrets = lib.mkEnableOption "automatic management of secrets"; - }; - - config = lib.mkIf cfg.enable ( - lib.mkMerge [ - { - networking.firewall = { - # all connections from tailscale are safe...or should be - trustedInterfaces = [ config.services.tailscale.interfaceName ]; - }; - - services.tailscale = { - enable = true; - openFirewall = true; - }; - } - - (lib.mkIf cfg.ssh.enable { - networking.firewall = { - allowedTCPPorts = [ 22 ]; - }; - - services.tailscale = { - extraUpFlags = [ "--ssh" ]; - }; - }) - - (lib.mkIf cfg.manageSecrets { - age.secrets = lib.mkIf cfg.manageSecrets { - tailscaleAuthKey.file = "${secretsDir}/tailscaleAuthKey.age"; - }; - - services.tailscale = { - authKeyFile = config.age.secrets.tailscaleAuthKey.path; - }; - }) - ] - ); -} -- cgit v1.2.3