summaryrefslogtreecommitdiff
path: root/modules/nixos/traits/tailscale.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-02-28 07:31:21 -0500
committerseth <[email protected]>2024-02-28 07:31:21 -0500
commit4caa14d0416c8ac14e0ac617a1eec22b9df830f6 (patch)
treeab2a295461a046118841c046fc1d6a3b6bbf7c38 /modules/nixos/traits/tailscale.nix
parented23d606f190aa20e620063ab65e78caf613b67c (diff)
nixos: remove root password
Diffstat (limited to 'modules/nixos/traits/tailscale.nix')
-rw-r--r--modules/nixos/traits/tailscale.nix49
1 files changed, 27 insertions, 22 deletions
diff --git a/modules/nixos/traits/tailscale.nix b/modules/nixos/traits/tailscale.nix
index b432ced..a7d8c06 100644
--- a/modules/nixos/traits/tailscale.nix
+++ b/modules/nixos/traits/tailscale.nix
@@ -16,33 +16,38 @@ in {
};
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- networking.firewall =
- {
- trustedInterfaces = ["tailscale0"];
- }
- // lib.optionalAttrs cfg.ssh.enable {
- allowedTCPPorts = [22];
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ networking.firewall = {
+ trustedInterfaces = [config.services.tailscale.interfaceName];
};
- services.tailscale =
- {
+ services.tailscale = {
enable = true;
openFirewall = true;
- }
- // lib.optionalAttrs cfg.ssh.enable {
+ };
+ }
+
+ (lib.mkIf cfg.ssh.enable {
+ networking.firewall = {
+ allowedTCPPorts = [22];
+ };
+
+ services.tailscale = {
extraUpFlags = ["--ssh"];
- }
- // lib.optionalAttrs cfg.manageSecrets {
- authKeyFile = config.age.secrets.tailscaleAuthKey.path;
};
- }
+ })
- (lib.mkIf cfg.manageSecrets {
- age.secrets = lib.mkIf cfg.manageSecrets {
- tailscaleAuthKey.file = "${secretsDir}/tailscaleAuthKey.age";
- };
- })
- ]);
+ (lib.mkIf cfg.manageSecrets {
+ age.secrets = lib.mkIf cfg.manageSecrets {
+ tailscaleAuthKey.file = "${secretsDir}/tailscaleAuthKey.age";
+ };
+
+ services.tailscale = {
+ authKeyFile = config.age.secrets.tailscaleAuthKey.path;
+ };
+ })
+ ]
+ );
}