From f89894e2e3896c39141a7a12deceb01758b4447b Mon Sep 17 00:00:00 2001 From: Thomas Gerbet Date: Sun, 17 Apr 2022 11:16:25 +0200 Subject: [PATCH] nixos/tailscale: allow to set `TS_PERMIT_CERT_UID` env variable This setting was introduced with Tailscale 1.22.0, see https://github.com/tailscale/tailscale/releases/tag/v1.22.0 Co-authored-by: pennae --- nixos/modules/services/networking/tailscale.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/tailscale.nix b/nixos/modules/services/networking/tailscale.nix index 3f41646bf01e..1f64113950a7 100644 --- a/nixos/modules/services/networking/tailscale.nix +++ b/nixos/modules/services/networking/tailscale.nix @@ -21,6 +21,12 @@ in { description = ''The interface name for tunnel traffic. Use "userspace-networking" (beta) to not use TUN.''; }; + permitCertUid = mkOption { + type = types.nullOr types.nonEmptyStr; + default = null; + description = "Username or user ID of the user allowed to to fetch Tailscale TLS certificates for the node."; + }; + package = mkOption { type = types.package; default = pkgs.tailscale; @@ -38,7 +44,9 @@ in { serviceConfig.Environment = [ "PORT=${toString cfg.port}" ''"FLAGS=--tun ${lib.escapeShellArg cfg.interfaceName}"'' - ]; + ] ++ (lib.optionals (cfg.permitCertUid != null) [ + "TS_PERMIT_CERT_UID=${cfg.permitCertUid}" + ]); }; }; }