From e81d3ea1b86b16b190d2e784c226916129af4ad0 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 27 Mar 2023 11:09:36 -0300 Subject: [PATCH] goreleaser: install completions and manpages Signed-off-by: Carlos Alexandro Becker --- pkgs/tools/misc/goreleaser/default.nix | 38 ++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/misc/goreleaser/default.nix b/pkgs/tools/misc/goreleaser/default.nix index 378e2e060b39..5fa4b236981d 100644 --- a/pkgs/tools/misc/goreleaser/default.nix +++ b/pkgs/tools/misc/goreleaser/default.nix @@ -1,4 +1,10 @@ -{ lib, buildGoModule, fetchFromGitHub }: +{ stdenv +, lib +, buildGoModule +, fetchFromGitHub +, installShellFiles +, buildPackages +}: buildGoModule rec { pname = "goreleaser"; @@ -13,20 +19,36 @@ buildGoModule rec { vendorHash = "sha256-eVuEyQCO2/gufMJp8eUpC82wdJbbJsMKR1ZGv96C9mI="; - ldflags = [ - "-s" - "-w" - "-X main.version=${version}" - "-X main.builtBy=nixpkgs" - ]; + ldflags = + [ "-s" "-w" "-X main.version=${version}" "-X main.builtBy=nixpkgs" ]; # tests expect the source files to be a build repo doCheck = false; + nativeBuildInputs = [ installShellFiles ]; + + postInstall = + let emulator = stdenv.hostPlatform.emulator buildPackages; + in '' + ${emulator} $out/bin/goreleaser man > goreleaser.1 + installManPage ./goreleaser.1 + installShellCompletion --cmd goreleaser \ + --bash <(${emulator} $out/bin/goreleaser completion bash) \ + --fish <(${emulator} $out/bin/goreleaser completion fish) \ + --zsh <(${emulator} $out/bin/goreleaser completion zsh) + ''; + meta = with lib; { description = "Deliver Go binaries as fast and easily as possible"; homepage = "https://goreleaser.com"; - maintainers = with maintainers; [ c0deaddict endocrimes sarcasticadmin techknowlogick developer-guy caarlos0 ]; + maintainers = with maintainers; [ + c0deaddict + endocrimes + sarcasticadmin + techknowlogick + developer-guy + caarlos0 + ]; license = licenses.mit; }; }