Add tailscale configuration for WSL2

Related to https://github.com/tailscale/tailscale/issues/562
This commit is contained in:
Dave Gallant
2022-07-03 15:31:35 +00:00
parent 078d43e3be
commit 2cd59475de
3 changed files with 37 additions and 0 deletions

View File

@@ -28,6 +28,8 @@ in {
# Enable integration with Docker Desktop
docker.enable = true;
tailscale.enable = true;
};
# Enable nix flakes

View File

@@ -23,6 +23,7 @@
./modules/build-tarball.nix
./modules/wsl-distro.nix
./modules/docker-desktop.nix
./modules/tailscale.nix
./modules/installer.nix
];
};

View File

@@ -0,0 +1,34 @@
{
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";
};
};
};
}