diff options
author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-07-29 06:12:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-29 06:12:26 +0200 |
commit | 80d8a945dd850475264e358aabaed46fcbfb987f (patch) | |
tree | 3d3074adacd1a4ee85bac6aae8d8f055b6c97d78 /nixos/modules/services/networking | |
parent | 11cf5e1c74fe6892e860afeeaf3bfb84fdb7b1c3 (diff) | |
parent | 2dbda3314fb7bef997d93ce641e9a82752072485 (diff) |
Merge pull request #245570 from jwygoda/tailscaled-autoconnect-options
nixos/tailscale: add extraUpFlags option
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/tailscale.nix | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/nixos/modules/services/networking/tailscale.nix b/nixos/modules/services/networking/tailscale.nix index dfb5422a1e9a0..f308b7e331140 100644 --- a/nixos/modules/services/networking/tailscale.nix +++ b/nixos/modules/services/networking/tailscale.nix @@ -29,12 +29,7 @@ in { description = lib.mdDoc "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; - defaultText = literalExpression "pkgs.tailscale"; - description = lib.mdDoc "The package to use for tailscale"; - }; + package = lib.mkPackageOptionMD pkgs "tailscale" {}; useRoutingFeatures = mkOption { type = types.enum [ "none" "client" "server" "both" ]; @@ -58,6 +53,13 @@ in { A file containing the auth key. ''; }; + + extraUpFlags = mkOption { + description = lib.mdDoc "Extra flags to pass to {command}`tailscale up`."; + type = types.listOf types.str; + default = []; + example = ["--ssh"]; + }; }; config = mkIf cfg.enable { @@ -98,10 +100,10 @@ in { serviceConfig = { Type = "oneshot"; }; - script = with pkgs; '' + script = '' status=$(${config.systemd.package}/bin/systemctl show -P StatusText tailscaled.service) if [[ $status != Connected* ]]; then - ${pkgs.tailscale}/bin/tailscale up --auth-key 'file:${cfg.authKeyFile}' + ${cfg.package}/bin/tailscale up --auth-key 'file:${cfg.authKeyFile}' ${escapeShellArgs cfg.extraUpFlags} fi ''; }; |