nixpkgs-package.nix

 1{
 2  lib,
 3  buildGoModule,
 4  fetchFromGitHub,
 5  pkg-config,
 6  pcsclite,
 7  stdenv,
 8  apple-sdk_15,
 9  nix-update-script,
10  versionCheckHook,
11}:
12
13buildGoModule (finalAttrs: {
14  __structuredAttrs = true;
15
16  pname = "matcha";
17  version = "0.37.0";
18
19  src = fetchFromGitHub {
20    owner = "floatpane";
21    repo = "matcha";
22    tag = "v${finalAttrs.version}";
23    hash = lib.fakeHash;
24  };
25
26  vendorHash = lib.fakeHash;
27  proxyVendor = true;
28
29  nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
30    pkg-config
31  ];
32
33  buildInputs =
34    lib.optionals stdenv.hostPlatform.isLinux [ pcsclite ]
35    ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ];
36
37  env.CGO_ENABLED = 1;
38
39  ldflags = [
40    "-s"
41    "-w"
42    "-X main.version=${finalAttrs.version}"
43    "-X main.date=1970-01-01T00:00:00Z"
44  ];
45
46  nativeInstallCheckInputs = [ versionCheckHook ];
47  doInstallCheck = true;
48  versionCheckProgramArg = "--version";
49
50  passthru.updateScript = nix-update-script { };
51
52  meta = {
53    description = "Beautiful and functional email client for the terminal";
54    homepage = "https://matcha.email";
55    changelog = "https://github.com/floatpane/matcha/releases/tag/v${finalAttrs.version}";
56    license = lib.licenses.mit;
57    mainProgram = "matcha";
58    maintainers = with lib.maintainers; [ andrinoff ];
59    platforms = lib.platforms.darwin ++ lib.platforms.linux;
60  };
61})