diff options
author | Profpatsch <mail@profpatsch.de> | 2021-06-04 22:18:59 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-06-14 11:25:08 +0200 |
commit | 799cdbd8342c5ad3adbede25caf6d544c56f019b (patch) | |
tree | 1c6f3e8d066eacbb4e499974d02ce84abc170870 /nixos/modules/services/networking/tailscale.nix | |
parent | 44c5e2b26db71e6600d960e2e1f2c798dd809155 (diff) | |
download | nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar.gz nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar.bz2 nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar.lz nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar.xz nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.tar.zst nixpkgs-799cdbd8342c5ad3adbede25caf6d544c56f019b.zip |
tailscale: add `interfaceName` option
tailscale allows to specify the interface name. The upstream systemd unit does not expose it directly however, only via the `FLAGS` environment variable. I can’t be 100% sure that the escaping is correct, but this is as good as we can do for now, unless upstream changes their unit file.
Diffstat (limited to 'nixos/modules/services/networking/tailscale.nix')
-rw-r--r-- | nixos/modules/services/networking/tailscale.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/tailscale.nix b/nixos/modules/services/networking/tailscale.nix index 9a28a266a92..c33a38179ee 100644 --- a/nixos/modules/services/networking/tailscale.nix +++ b/nixos/modules/services/networking/tailscale.nix @@ -15,6 +15,12 @@ in { description = "The port to listen on for tunnel traffic (0=autoselect)."; }; + interfaceName = mkOption { + type = types.str; + default = "tailscale0"; + description = ''The interface name for tunnel traffic. Use "userspace-networking" (beta) to not use TUN.''; + }; + package = mkOption { type = types.package; default = pkgs.tailscale; @@ -29,7 +35,10 @@ in { systemd.services.tailscaled = { wantedBy = [ "multi-user.target" ]; path = [ pkgs.openresolv ]; - serviceConfig.Environment = "PORT=${toString cfg.port}"; + serviceConfig.Environment = [ + "PORT=${toString cfg.port}" + ''"FLAGS=--tun ${lib.escapeShellArg cfg.interfaceName}"'' + ]; }; }; } |