nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 buildPackages,
8}:
9
10buildGoModule rec {
11 pname = "nfpm";
12 version = "2.43.0";
13
14 src = fetchFromGitHub {
15 owner = "goreleaser";
16 repo = "nfpm";
17 rev = "v${version}";
18 hash = "sha256-HbGO4+wFp2mRBOKNxbnZ9sHUJS25ZQ4RaC1Eaw0kfrg=";
19 };
20
21 vendorHash = "sha256-BN+ruaajQuvFa/tECI9s0no6+EFR7BYoa1+Z/YI1PbY=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X main.version=${version}"
27 ];
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 postInstall =
32 let
33 emulator = stdenv.hostPlatform.emulator buildPackages;
34 in
35 ''
36 ${emulator} $out/bin/nfpm man > nfpm.1
37 installManPage ./nfpm.1
38 installShellCompletion --cmd nfpm \
39 --bash <(${emulator} $out/bin/nfpm completion bash) \
40 --fish <(${emulator} $out/bin/nfpm completion fish) \
41 --zsh <(${emulator} $out/bin/nfpm completion zsh)
42 '';
43
44 meta = {
45 description = "Simple deb and rpm packager written in Go";
46 homepage = "https://github.com/goreleaser/nfpm";
47 changelog = "https://github.com/goreleaser/nfpm/releases/tag/v${version}";
48 maintainers = with lib.maintainers; [
49 techknowlogick
50 caarlos0
51 ];
52 license = with lib.licenses; [ mit ];
53 mainProgram = "nfpm";
54 };
55}