From 5b264ef735abb745d0421c1c1c0fb7d510ddcf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 24 Nov 2024 15:32:11 +0000 Subject: [PATCH] add tailscale funnel --- devenv.lock | 12 ++++++------ src/modules/services/tailscale.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 src/modules/services/tailscale.nix diff --git a/devenv.lock b/devenv.lock index 322f63949..6663d67c0 100644 --- a/devenv.lock +++ b/devenv.lock @@ -16,10 +16,10 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, + "lastModified": 1732722421, "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", "type": "github" }, "original": { @@ -73,10 +73,10 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1730302582, + "lastModified": 1733318908, "owner": "cachix", "repo": "git-hooks.nix", - "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", + "rev": "6f4e2a2112050951a314d2733a994fbab94864c6", "type": "github" }, "original": { @@ -191,10 +191,10 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1730327045, + "lastModified": 1733220138, "owner": "NixOS", "repo": "nixpkgs", - "rev": "080166c15633801df010977d9d7474b4a6c549d7", + "rev": "bcb68885668cccec12276bbb379f8f2557aa06ce", "type": "github" }, "original": { diff --git a/src/modules/services/tailscale.nix b/src/modules/services/tailscale.nix new file mode 100644 index 000000000..ba57439da --- /dev/null +++ b/src/modules/services/tailscale.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.tailscale; +in +{ + options = { + services.tailscale = { + funnel = { + enable = mkEnableOption "Tailscale funnel"; + + target = mkOption { + type = types.str; + description = "Target host or host:port for Tailscale funnel"; + }; + }; + }; + }; + + config.processes = lib.mkIf cfg.funnel.enable { + "tailscale-funnel" = { + exec = "${pkgs.tailscale}/bin/tailscale funnel --yes ${cfg.funnel.target}"; + }; + }; +}