fixed tailscale module

This commit is contained in:
pazpi 2024-08-30 08:21:48 +02:00
parent 7744a46b76
commit 6c9f2e1b41

View file

@ -4,35 +4,50 @@
pkgs, pkgs,
... ...
}: }:
with lib;
let let
cfg = config.my.networking.tailscale; cfg = config.my.networking.tailscale;
in in
{ {
options.my.networking.tailscale = {
enable = lib.mkEnableOption "Enable Tailscale module";
authKeyFile = lib.mkOption { # If tailscaled activated on a unprivileged container this must be set on the Proxmox host.
default = ""; # https://tailscale.com/kb/1130/lxc-unprivileged
type = config.services.tailscale.authKeyFile.type; # lxc.cgroup2.devices.allow: c 10:200 rwm
description = config.services.tailscale.authKeyFile.description; # lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
options.my.networking.tailscale = {
enable = mkEnableOption "Enable Tailscale module";
authKeyFile = mkOption {
type = types.nullOr types.path;
default = null;
example = "/run/secrets/tailscale_key";
description = ''
A file containing the auth key.
'';
}; };
exitNode = lib.mkOption { exitNode = mkOption {
type = types.str;
default = ""; default = "";
example = "server-name";
description = '' description = ''
The tailscale IP of the optional exit node. The tailscale IP of the optional exit node.
''; '';
}; };
extraUpFlags = lib.mkOption { extraUpFlags = mkOption {
default = ""; description = ''
type = config.services.tailscale.extraUpFlags.type; Extra flags to pass to {command}`tailscale up`. Only applied if `authKeyFile` is specified.". The exit node set with `exitNode` are already applied.
description = config.services.tailscale.extraUpFlags.description; '';
type = types.listOf types.str;
default = [ ];
example = [ "--ssh" ];
}; };
}; };
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
services.tailscale = { services.tailscale = {
enable = true; enable = true;
authKeyFile = cfg.authKeyFile; authKeyFile = cfg.authKeyFile;