From 51312397b590a854096316e9c921ed828a2057b9 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sun, 10 Nov 2024 12:16:05 +0100 Subject: [PATCH] Simplify tailscale configuration --- machines/gamepc/configuration.nix | 6 +++++- machines/sue/configuration.nix | 3 ++- nixos/default.nix | 7 +++++-- nixos/gnome.nix | 3 ++- nixos/tailscale.nix | 20 -------------------- 5 files changed, 14 insertions(+), 25 deletions(-) delete mode 100644 nixos/tailscale.nix diff --git a/machines/gamepc/configuration.nix b/machines/gamepc/configuration.nix index 1db1ecd..62324d0 100644 --- a/machines/gamepc/configuration.nix +++ b/machines/gamepc/configuration.nix @@ -10,7 +10,11 @@ facter.reportPath = ./facter.json; networking.hostName = "gamepc"; - services.openssh.enable = true; + + services = { + openssh.enable = true; + tailscale.enable = true; + }; users.users = { root.password = ""; diff --git a/machines/sue/configuration.nix b/machines/sue/configuration.nix index c6d10ac..0dab29d 100644 --- a/machines/sue/configuration.nix +++ b/machines/sue/configuration.nix @@ -6,11 +6,12 @@ gnome.enable = true; stylix.enable = true; wireguard.enable = true; - tailscale.enable = true; compliance.enable = true; sops.enable = true; }; + services.tailscale.enable = true; + facter.reportPath = ./facter.json; networking.hostName = "xps-9315"; diff --git a/nixos/default.nix b/nixos/default.nix index b705232..822edf8 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -17,7 +17,6 @@ ./stylix.nix ./wireguard.nix ./gnome.nix - ./tailscale.nix ./compliance.nix ./cinnamon.nix ./ssh.nix @@ -28,6 +27,7 @@ programs.ssh.startAgent = true; services = { + tailscale.useRoutingFeatures = "client"; xserver.enable = true; printing = { @@ -113,7 +113,10 @@ }; }; - networking.useDHCP = lib.mkDefault true; + networking = { + useDHCP = lib.mkDefault true; + networkmanager.unmanaged = lib.mkIf config.services.tailscale.enable ["tailscale0"]; + }; virtualisation.docker = { enable = true; diff --git a/nixos/gnome.nix b/nixos/gnome.nix index 8b4c299..8725e41 100644 --- a/nixos/gnome.nix +++ b/nixos/gnome.nix @@ -29,7 +29,8 @@ in { window-is-ready-remover random-wallpaper workspaces-indicator-by-open-apps - ]); + ]) + ++ lib.optional config.services.tailscale.enable pkgs.gnomeExtensions.tailscale-status; gnome.excludePackages = (with pkgs; [ diff --git a/nixos/tailscale.nix b/nixos/tailscale.nix deleted file mode 100644 index 8b299dc..0000000 --- a/nixos/tailscale.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.pim.tailscale; -in { - options.pim.tailscale.enable = lib.mkEnableOption "tailscale"; - config = lib.mkIf cfg.enable { - environment.systemPackages = [pkgs.gnomeExtensions.tailscale-status]; - - services.tailscale = { - enable = true; - useRoutingFeatures = "client"; - }; - - networking.networkmanager.unmanaged = ["tailscale0"]; - }; -}