Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / applications / misc / hugo / default.nix
blobef9be284b59d65b93f15cb1aeec692567bed43bf
1 { stdenv
2 , lib
3 , buildGoModule
4 , fetchFromGitHub
5 , installShellFiles
6 , buildPackages
7 , testers
8 , hugo
9 }:
11 buildGoModule rec {
12   pname = "hugo";
13   version = "0.120.3";
15   src = fetchFromGitHub {
16     owner = "gohugoio";
17     repo = pname;
18     rev = "refs/tags/v${version}";
19     hash = "sha256-96ikGGKw9IN/ch199oFcucp8aVR+fEiAWBeu39J2Osw=";
20   };
22   vendorHash = "sha256-kUKnoUQzLbi0ssxvK2viNTHLtqx8vaHLYXO8ZWU2rmw=";
24   doCheck = false;
26   proxyVendor = true;
28   tags = [ "extended" ];
30   subPackages = [ "." ];
32   nativeBuildInputs = [ installShellFiles ];
34   ldflags = [ "-s" "-w" "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=nixpkgs" ];
36   postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
37     ${emulator} $out/bin/hugo gen man
38     installManPage man/*
39     installShellCompletion --cmd hugo \
40       --bash <(${emulator} $out/bin/hugo completion bash) \
41       --fish <(${emulator} $out/bin/hugo completion fish) \
42       --zsh  <(${emulator} $out/bin/hugo completion zsh)
43   '';
45   passthru.tests.version = testers.testVersion {
46     package = hugo;
47     command = "hugo version";
48     version = "v${version}";
49   };
51   meta = with lib; {
52     description = "A fast and modern static website engine";
53     homepage = "https://gohugo.io";
54     license = licenses.asl20;
55     maintainers = with maintainers; [ schneefux Br1ght0ne Frostman ];
56   };