31 lines
675 B
Nix
31 lines
675 B
Nix
{
|
|
config,
|
|
lib,
|
|
namespace,
|
|
...
|
|
}: let
|
|
inherit (lib) mkIf mkEnableOption;
|
|
inherit (lib.${namespace}) getAttrByNamespace mkOptionsWithNamespace;
|
|
base = "${namespace}.services.networking.tailscale";
|
|
cfg = getAttrByNamespace config base;
|
|
in {
|
|
options = mkOptionsWithNamespace base {
|
|
enable = mkEnableOption "Tailscale";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.tailscale = {
|
|
enable = true;
|
|
useRoutingFeatures = "server";
|
|
};
|
|
|
|
${namespace}.services.storage.impermanence.folders = [
|
|
{
|
|
directory = "/var/lib/tailscale";
|
|
user = "tailscale";
|
|
group = "tailscale";
|
|
mode = "700";
|
|
}
|
|
];
|
|
};
|
|
}
|