Files
nixpkgs/pkgs/by-name/wi/wireguard-go/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

75 lines
1.8 KiB
Nix

{
lib,
buildGoModule,
fetchzip,
testers,
wireguard-go,
}:
buildGoModule (
finalAttrs:
let
rev = "12269c2761734b15625017d8565745096325392f";
shortVer = "${finalAttrs.version} (${lib.substring 0 7 rev})";
in
{
pname = "wireguard-go";
version = "0-unstable-2023-12-11";
src = fetchzip {
url = "https://git.zx2c4.com/wireguard-go/snapshot/wireguard-go-${rev}.tar.xz";
hash = "sha256-br7/dwr/e4HvBGJXh+6lWqxBUezt5iZNy9BFqEA1bLk=";
};
postPatch = ''
# Skip formatting tests
rm -f format_test.go
# Inject version
printf 'package main\n\nconst Version = "${shortVer}"' > version.go
'';
vendorHash = "sha256-RqZ/3+Xus5N1raiUTUpiKVBs/lrJQcSwr1dJib2ytwc=";
subPackages = [ "." ];
ldflags = [ "-s" ];
# No tests besides the formatting one are in root.
# We can't override subPackages per-phase (and we don't
# want to needlessly build packages that have build
# constraints), so just use the upstream Makefile (that
# runs `go test ./...`) to actually run the tests.
checkPhase = ''
runHook preCheck
export GOFLAGS=''${GOFLAGS//-trimpath/}
make test
runHook postCheck
'';
# Tests require networking.
__darwinAllowLocalNetworking = finalAttrs.doCheck;
postInstall = ''
mv $out/bin/wireguard $out/bin/wireguard-go
'';
passthru.tests.version = testers.testVersion {
package = wireguard-go;
version = "v${shortVer}";
};
meta = with lib; {
description = "Userspace Go implementation of WireGuard";
homepage = "https://git.zx2c4.com/wireguard-go/about/";
license = licenses.mit;
maintainers = with maintainers; [
kirelagin
winter
zx2c4
];
mainProgram = "wireguard-go";
};
}
)