Files
nixpkgs/pkgs/by-name/us/usque/package.nix
2026-06-16 22:04:06 +02:00

62 lines
1.6 KiB
Nix

{
lib,
buildGo125Module,
fetchFromGitHub,
stdenv,
nix-update-script,
buildPackages,
installShellFiles,
versionCheckHook,
}:
buildGo125Module (finalAttrs: {
pname = "usque";
version = "3.0.1";
src = fetchFromGitHub {
owner = "Diniboy1123";
repo = "usque";
tag = "v${finalAttrs.version}";
hash = "sha256-4vFlHJINMDlaOC+R5Q+vUhmyrXlv1r8UiNVRx8juxZ4=";
};
vendorHash = "sha256-/SYyIWRr+uwF5Jr5Ql08a+WwrZMXmKEa+Q7Nxzt2wKw=";
ldflags = [
"-s"
"-w"
"-X github.com/Diniboy1123/usque/cmd.version=${finalAttrs.version}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall =
let
exe =
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
"$out/bin/usque"
else
lib.getExe buildPackages.usque;
in
''
installShellCompletion --cmd usque \
--bash <(${exe} completion bash) \
--fish <(${exe} completion fish) \
--zsh <(${exe} completion zsh)
'';
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
versionCheckProgramArg = "version";
passthru.updateScript = nix-update-script { };
meta = {
mainProgram = "usque";
maintainers = with lib.maintainers; [ xddxdd ];
description = "Open-source reimplementation of the Cloudflare WARP client's MASQUE protocol";
homepage = "https://github.com/Diniboy1123/usque";
license = lib.licenses.mit;
changelog = "https://github.com/Diniboy1123/usque/releases/tag/v${finalAttrs.version}";
};
})