gotop: fix darwin build

This commit is contained in:
Stanisław Pitucha 2022-09-01 20:49:00 +10:00
parent cc9c837aa2
commit 9be329377c
2 changed files with 22 additions and 6 deletions

View file

@ -1,4 +1,11 @@
{ lib, stdenv, buildGoModule, fetchFromGitHub, installShellFiles }:
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, fetchpatch
, installShellFiles
, IOKit
}:
buildGoModule rec {
pname = "gotop";
@ -11,19 +18,27 @@ buildGoModule rec {
hash = "sha256-jAUlaj9Nv/ipzxAkG2myd9DIboHj7IarNMVk/FQ274g=";
};
patches = [
# To remove after https://github.com/xxxserxxx/gotop/pull/234 is merged
(fetchpatch {
url = "https://github.com/xxxserxxx/gotop/commit/3e3243fa1f046c126bf9cb34d55a12963b3ac116.patch";
sha256 = "sha256-4q4dBTPpVfgXvApzUXdEEzIe31PoLHUK4mBWth6qCIg=";
})
];
proxyVendor = true;
vendorSha256 = "sha256-y4hVouvqMYUrdF7fowsvJLp0FCGCZDeVGUQXG8z8Lyg=";
vendorSha256 = "sha256-Sq9ol9bZb0BfR/C8phcMSEjG9qgWyTmwpo/TS30j3Vk=";
ldflags = [ "-s" "-w" "-X main.Version=v${version}" ];
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ IOKit ];
preCheck = ''
export HOME=$(mktemp -d)
'';
doCheck = !stdenv.isDarwin;
postInstall = ''
$out/bin/gotop --create-manpage > gotop.1
installManPage gotop.1
@ -35,6 +50,5 @@ buildGoModule rec {
changelog = "https://github.com/xxxserxxx/gotop/raw/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = [ maintainers.magnetophon ];
broken = stdenv.isDarwin; # needs to update gopsutil to at least v3.21.3 to include https://github.com/shirou/gopsutil/pull/1042
};
}

View file

@ -24493,7 +24493,9 @@ with pkgs;
gotools = callPackage ../development/tools/gotools { };
gotop = callPackage ../tools/system/gotop { };
gotop = callPackage ../tools/system/gotop {
inherit (darwin.apple_sdk.frameworks) IOKit;
};
go-migrate = callPackage ../development/tools/go-migrate { };