|
|
|
|
@ -40,7 +40,12 @@ |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils, flake-compat }: let |
|
|
|
|
outputs = { |
|
|
|
|
self, |
|
|
|
|
nixpkgs, |
|
|
|
|
flake-utils, |
|
|
|
|
flake-compat, |
|
|
|
|
}: let |
|
|
|
|
# tailscaleRev is the git commit at which this flake was imported, |
|
|
|
|
# or the empty string when building from a local checkout of the |
|
|
|
|
# tailscale repo. |
|
|
|
|
@ -62,36 +67,37 @@ |
|
|
|
|
# So really, this flake is for tailscale devs to dogfood with, if |
|
|
|
|
# you're an end user you should be prepared for this flake to not |
|
|
|
|
# build periodically. |
|
|
|
|
tailscale = pkgs: pkgs.buildGo122Module rec { |
|
|
|
|
name = "tailscale"; |
|
|
|
|
tailscale = pkgs: |
|
|
|
|
pkgs.buildGo123Module rec { |
|
|
|
|
name = "tailscale"; |
|
|
|
|
|
|
|
|
|
src = ./.; |
|
|
|
|
vendorHash = pkgs.lib.fileContents ./go.mod.sri; |
|
|
|
|
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.makeWrapper ]; |
|
|
|
|
ldflags = ["-X tailscale.com/version.gitCommitStamp=${tailscaleRev}"]; |
|
|
|
|
CGO_ENABLED = 0; |
|
|
|
|
subPackages = [ "cmd/tailscale" "cmd/tailscaled" ]; |
|
|
|
|
doCheck = false; |
|
|
|
|
src = ./.; |
|
|
|
|
vendorHash = pkgs.lib.fileContents ./go.mod.sri; |
|
|
|
|
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [pkgs.makeWrapper]; |
|
|
|
|
ldflags = ["-X tailscale.com/version.gitCommitStamp=${tailscaleRev}"]; |
|
|
|
|
CGO_ENABLED = 0; |
|
|
|
|
subPackages = ["cmd/tailscale" "cmd/tailscaled"]; |
|
|
|
|
doCheck = false; |
|
|
|
|
|
|
|
|
|
# NOTE: We strip the ${PORT} and $FLAGS because they are unset in the |
|
|
|
|
# environment and cause issues (specifically the unset PORT). At some |
|
|
|
|
# point, there should be a NixOS module that allows configuration of these |
|
|
|
|
# things, but for now, we hardcode the default of port 41641 (taken from |
|
|
|
|
# ./cmd/tailscaled/tailscaled.defaults). |
|
|
|
|
postInstall = pkgs.lib.optionalString pkgs.stdenv.isLinux '' |
|
|
|
|
wrapProgram $out/bin/tailscaled --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.iproute2 pkgs.iptables pkgs.getent pkgs.shadow ]} |
|
|
|
|
wrapProgram $out/bin/tailscale --suffix PATH : ${pkgs.lib.makeBinPath [ pkgs.procps ]} |
|
|
|
|
# NOTE: We strip the ${PORT} and $FLAGS because they are unset in the |
|
|
|
|
# environment and cause issues (specifically the unset PORT). At some |
|
|
|
|
# point, there should be a NixOS module that allows configuration of these |
|
|
|
|
# things, but for now, we hardcode the default of port 41641 (taken from |
|
|
|
|
# ./cmd/tailscaled/tailscaled.defaults). |
|
|
|
|
postInstall = pkgs.lib.optionalString pkgs.stdenv.isLinux '' |
|
|
|
|
wrapProgram $out/bin/tailscaled --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.iproute2 pkgs.iptables pkgs.getent pkgs.shadow]} |
|
|
|
|
wrapProgram $out/bin/tailscale --suffix PATH : ${pkgs.lib.makeBinPath [pkgs.procps]} |
|
|
|
|
|
|
|
|
|
sed -i \ |
|
|
|
|
-e "s#/usr/sbin#$out/bin#" \ |
|
|
|
|
-e "/^EnvironmentFile/d" \ |
|
|
|
|
-e 's/''${PORT}/41641/' \ |
|
|
|
|
-e 's/$FLAGS//' \ |
|
|
|
|
./cmd/tailscaled/tailscaled.service |
|
|
|
|
sed -i \ |
|
|
|
|
-e "s#/usr/sbin#$out/bin#" \ |
|
|
|
|
-e "/^EnvironmentFile/d" \ |
|
|
|
|
-e 's/''${PORT}/41641/' \ |
|
|
|
|
-e 's/$FLAGS//' \ |
|
|
|
|
./cmd/tailscaled/tailscaled.service |
|
|
|
|
|
|
|
|
|
install -D -m0444 -t $out/lib/systemd/system ./cmd/tailscaled/tailscaled.service |
|
|
|
|
''; |
|
|
|
|
}; |
|
|
|
|
install -D -m0444 -t $out/lib/systemd/system ./cmd/tailscaled/tailscaled.service |
|
|
|
|
''; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
# This whole blob makes the tailscale package available for all |
|
|
|
|
# OS/CPU combos that nix supports, as well as a dev shell so that |
|
|
|
|
@ -112,7 +118,7 @@ |
|
|
|
|
gotools |
|
|
|
|
graphviz |
|
|
|
|
perl |
|
|
|
|
go_1_22 |
|
|
|
|
go_1_23 |
|
|
|
|
yarn |
|
|
|
|
]; |
|
|
|
|
}; |
|
|
|
|
|