mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 00:58:16 +00:00
35 lines
645 B
Nix
35 lines
645 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with builtins;
|
|
with lib; {
|
|
options.wsl.tailscale = with types; {
|
|
enable = mkEnableOption "Tailscale for WSL";
|
|
};
|
|
|
|
config = let
|
|
cfg = config.wsl.tailscale;
|
|
in
|
|
mkIf (config.wsl.enable && cfg.enable) {
|
|
environment.systemPackages = with pkgs; [
|
|
tailscale
|
|
];
|
|
|
|
systemd.services.tailscaled = {
|
|
description = "Tailscale WSL";
|
|
script = ''
|
|
${pkgs.tailscale}/bin/tailscaled
|
|
'';
|
|
wantedBy = ["multi-user.target"];
|
|
serviceConfig = {
|
|
Restart = "on-failure";
|
|
RestartSec = "30s";
|
|
};
|
|
};
|
|
|
|
};
|
|
}
|