2023-09-14 10:47:12 +03:00
|
|
|
{ lib, stdenv, buildGoModule, fetchFromGitHub }:
|
|
|
|
|
|
|
|
let
|
2024-01-28 02:40:34 +03:00
|
|
|
version = "1.58.2";
|
2023-09-14 10:47:12 +03:00
|
|
|
in
|
|
|
|
buildGoModule {
|
|
|
|
pname = "tailscale-nginx-auth";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tailscale";
|
|
|
|
repo = "tailscale";
|
|
|
|
rev = "v${version}";
|
2024-01-28 02:40:34 +03:00
|
|
|
hash = "sha256-FiFFfUtse0CKR4XJ82HEjpZNxCaa4FnwSJfEzJ5kZgk=";
|
2023-09-14 10:47:12 +03:00
|
|
|
};
|
2024-01-22 10:48:21 +03:00
|
|
|
vendorHash = "sha256-BK1zugKGtx2RpWHDvFZaFqz/YdoewsG8SscGt25uwtQ=";
|
2023-09-14 10:47:12 +03:00
|
|
|
|
|
|
|
CGO_ENABLED = 0;
|
|
|
|
|
|
|
|
subPackages = [ "cmd/nginx-auth" ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-w"
|
|
|
|
"-s"
|
|
|
|
"-X tailscale.com/version.longStamp=${version}"
|
|
|
|
"-X tailscale.com/version.shortStamp=${version}"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = lib.optionalString stdenv.isLinux ''
|
|
|
|
mv $out/bin/nginx-auth $out/bin/tailscale.nginx-auth
|
|
|
|
sed -i -e "s#/usr/sbin#$out/bin#" ./cmd/nginx-auth/tailscale.nginx-auth.service
|
|
|
|
install -D -m0444 -t $out/lib/systemd/system ./cmd/nginx-auth/tailscale.nginx-auth.service
|
|
|
|
install -D -m0444 -t $out/lib/systemd/system ./cmd/nginx-auth/tailscale.nginx-auth.socket
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://tailscale.com";
|
|
|
|
description = "Tool that allows users to use Tailscale Whois authentication with NGINX as a reverse proxy.";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
mainProgram = "tailscale.nginx-auth";
|
|
|
|
maintainers = with maintainers; [ danderson phaer ];
|
|
|
|
};
|
|
|
|
}
|