hugo: fix cross compilation

This commit is contained in:
Nick Cao 2022-09-20 23:11:36 +08:00
parent f802caee6a
commit f412bce03a
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }: { stdenv, lib, buildGoModule, fetchFromGitHub, installShellFiles, buildPackages }:
buildGoModule rec { buildGoModule rec {
pname = "hugo"; pname = "hugo";
@ -25,13 +25,13 @@ buildGoModule rec {
ldflags = [ "-s" "-w" "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=nixpkgs" ]; ldflags = [ "-s" "-w" "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=nixpkgs" ];
postInstall = '' postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
$out/bin/hugo gen man ${emulator} $out/bin/hugo gen man
installManPage man/* installManPage man/*
installShellCompletion --cmd hugo \ installShellCompletion --cmd hugo \
--bash <($out/bin/hugo completion bash) \ --bash <(${emulator} $out/bin/hugo completion bash) \
--fish <($out/bin/hugo completion fish) \ --fish <(${emulator} $out/bin/hugo completion fish) \
--zsh <($out/bin/hugo completion zsh) --zsh <(${emulator} $out/bin/hugo completion zsh)
''; '';
meta = with lib; { meta = with lib; {