Skip to content

Commit

Permalink
nix: user space tailscale
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Aug 6, 2024
1 parent 17c7a44 commit 88ffe6e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion nix/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,29 @@ in
# }
# )

(
let name = "tailscaled";
in
lib.optionalAttrs prefs.enableHomeManagerTailScale {
services.${name} = {
enable = true;
Unit = {
Description = "user space tailscale daemon";
After = [ "network.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Service = {
RuntimeDirectory = name;
StateDirectory = name;
NoNewPrivileges = true;
ExecStart = ''
${pkgs.tailscale}/bin/tailscaled --statedir=''${STATE_DIRECTORY} --socket=''${RUNTIME_DIRECTORY}/${name}.sock --port=0 --tun=userspace-networking --verbose 5
'';
};
};
}
)

(
let name = "foot";
in
Expand All @@ -964,7 +987,7 @@ in

home = {
extraOutputsToInstall = prefs.extraOutputsToInstall;
packages = allPackages;
packages = allPackages ++ (lib.optionals prefs.enableHomeManagerTailScale [ pkgs.tailscale ]);
stateVersion = prefs.homeManagerStateVersion;
};

Expand Down
2 changes: 2 additions & 0 deletions nix/prefs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ let
enableAioproxy = !self.isMinimalSystem;
aioproxyPort = 4443;
enableTailScale = !self.isMinimalSystem;
enableHomeManagerTailScale = false;
enableNetbird = !self.isMinimalSystem;
enableX2goServer = false;
enableDebugInfo = false;
Expand Down Expand Up @@ -1025,6 +1026,7 @@ let
} else if hostname == "zklab-5" then {
home = "/home/contrun";
isMinimalSystem = false;
enableHomeManagerTailScale = true;
} else if hostname == "aol" then {
isMinimalSystem = false;
hostId = "85d4bfd4";
Expand Down

0 comments on commit 88ffe6e

Please sign in to comment.