tsnet-serve-nix @main -
refs -
log -
-
https://git.jolheiser.com/tsnet-serve-nix.git
fix(module): make package configurable
Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQLKyy0pMr85eI7cQoLntQIWWAIg2fzSdP56/GlLxGaueWJE9Q03M5Jy0NMChtUyFQK
bj8KWHEnbTtHmBW2H/TQw=
-----END SSH SIGNATURE-----
diff --git a/module/default.nix b/module/default.nix
index d8c7566622adbf98d081cbb11d7bdb1f65d8dc37..ef6f05259f55a14842bdd3ccd4396eae2b8aa245 100644
--- a/module/default.nix
+++ b/module/default.nix
@@ -14,43 +14,56 @@ ...
}: {
options = {
enable = lib.mkEnableOption "tsnet-serve-${name}";
+
user = lib.mkOption {
type = lib.types.str;
default = "tsnet-serve";
description = "User to run tsnet-serve";
};
+
backend = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Target URL to proxy";
example = "https://localhost:3000";
};
+
hostname = lib.mkOption {
type = lib.types.str;
default = name;
description = "App name";
example = "myapp";
};
+
port = lib.mkOption {
type = lib.types.port;
default = 443;
description = "Port to listen on";
};
+
mountPath = lib.mkOption {
type = lib.types.str;
default = "/";
description = "Path to mount proxy on";
};
+
stateDir = lib.mkOption {
type = lib.types.str;
default = "/var/lib/tsnet-serve-${name}";
description = "Directory to store state in";
};
+
authKey = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Tailscale auth key";
};
+
+ package = lib.mkOption {
+ type = lib.types.package;
+ default = pkg;
+ description = "The tsnet-serve package to use";
+ };
};
};
in {
@@ -81,7 +94,7 @@ "--listen-port=${builtins.toString instanceCfg.port}"
"--mount-path=${instanceCfg.mountPath}"
"--state-dir=${instanceCfg.stateDir}"
];
- cfg = config.services.tsnet-serve;
+
User = instanceCfg.user;
Restart = "on-failure";
Environment = ["TS_AUTHKEY=${instanceCfg.authKey}"];