mirror of
https://github.com/davegallant/nix-config
synced 2025-08-06 07:13:40 +00:00
Add tailscale configuration for WSL2
Related to https://github.com/tailscale/tailscale/issues/562
This commit is contained in:
@@ -28,6 +28,8 @@ in {
|
||||
|
||||
# Enable integration with Docker Desktop
|
||||
docker.enable = true;
|
||||
|
||||
tailscale.enable = true;
|
||||
};
|
||||
|
||||
# Enable nix flakes
|
||||
|
@@ -23,6 +23,7 @@
|
||||
./modules/build-tarball.nix
|
||||
./modules/wsl-distro.nix
|
||||
./modules/docker-desktop.nix
|
||||
./modules/tailscale.nix
|
||||
./modules/installer.nix
|
||||
];
|
||||
};
|
||||
|
34
machines/gallantis/nixos-wsl/modules/tailscale.nix
Normal file
34
machines/gallantis/nixos-wsl/modules/tailscale.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user