nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 makeWrapper,
7 ncurses,
8 versionCheckHook,
9 nix-update-script,
10}:
11
12buildGoModule rec {
13 pname = "wtfutil";
14 version = "0.46.1";
15
16 src = fetchFromGitHub {
17 owner = "wtfutil";
18 repo = "wtf";
19 rev = "v${version}";
20 sha256 = "sha256-GLLTI/hxlkt3OvtTWRNdzQ9jzO4xzJV9RruiJUyWD5g=";
21 };
22
23 vendorHash = "sha256-OSoQkBAx0kJKiKq0pRGrkkSowTynw/MJvYSdhd1Jt/k=";
24 proxyVendor = true;
25
26 doCheck = false;
27
28 ldflags = [
29 "-s"
30 "-w"
31 ];
32
33 subPackages = [ "." ];
34
35 nativeBuildInputs = [ makeWrapper ];
36
37 postPatch = ''
38 substituteInPlace flags/flags.go --replace-fail 'version := "dev"' 'version := "v${version}"'
39 '';
40
41 postInstall = ''
42 mv "$out/bin/wtf" "$out/bin/wtfutil"
43 wrapProgram "$out/bin/wtfutil" --prefix PATH : "${ncurses.dev}/bin"
44 '';
45
46 doInstallCheck = true;
47 # Darwin Error: mkdir /var/empty: file exists
48 nativeInstallCheckInputs = lib.optional (!stdenv.hostPlatform.isDarwin) [ versionCheckHook ];
49
50 passthru.updateScript = nix-update-script { };
51
52 meta = {
53 description = "Personal information dashboard for your terminal";
54 homepage = "https://wtfutil.com/";
55 changelog = "https://github.com/wtfutil/wtf/raw/v${version}/CHANGELOG.md";
56 license = lib.licenses.mpl20;
57 maintainers = with lib.maintainers; [
58 xiaoxiangmoe
59 kalbasit
60 ];
61 mainProgram = "wtfutil";
62 platforms = lib.platforms.linux ++ lib.platforms.darwin;
63 };
64}