mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-06 05:18:12 +09:00
39 lines
924 B
Nix
39 lines
924 B
Nix
{ lib, config, ... }:
|
|
let
|
|
cfg = config.my.applications.tailscale;
|
|
in
|
|
{
|
|
options.my.applications.tailscale = {
|
|
enable = lib.mkEnableOption "Tailscale VPN";
|
|
|
|
acceptDns = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Accept DNS configuration from Tailscale";
|
|
};
|
|
|
|
acceptRoutes = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Accept subnet routes from Tailscale";
|
|
};
|
|
|
|
extraUpFlags = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
description = "Additional flags to pass to tailscale up";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.tailscale = {
|
|
enable = true;
|
|
extraUpFlags = [
|
|
"--accept-dns=${if cfg.acceptDns then "true" else "false"}"
|
|
]
|
|
++ lib.optional cfg.acceptRoutes "--accept-routes"
|
|
++ cfg.extraUpFlags;
|
|
};
|
|
};
|
|
}
|