nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromSourcehut,
5 ncurses,
6 withNotmuch ? true,
7 notmuch,
8 scdoc,
9 python3Packages,
10 w3m,
11 dante,
12 gawk,
13 versionCheckHook,
14 bashNonInteractive,
15 nix-update-script,
16}:
17
18buildGoModule (finalAttrs: {
19 pname = "aerc";
20 version = "0.21.0";
21
22 src = fetchFromSourcehut {
23 owner = "~rjarry";
24 repo = "aerc";
25 rev = finalAttrs.version;
26 hash = "sha256-UBXMAIuB0F7gG0dkpEF/3V4QK6FEbQw2ZLGGmRF884I=";
27 };
28
29 proxyVendor = true;
30 vendorHash = "sha256-E/DnfiHoDDNNoaNGZC/nvs8DiJ8F2+H2FzxpU7nK+bE=";
31
32 nativeBuildInputs = [
33 scdoc
34 python3Packages.wrapPython
35 ];
36
37 patches = [ ./runtime-libexec.patch ];
38
39 postPatch = ''
40 substituteAllInPlace config/aerc.conf
41 substituteAllInPlace config/config.go
42 substituteAllInPlace doc/aerc-config.5.scd
43 substituteAllInPlace doc/aerc-templates.7.scd
44
45 # Prevent buildGoModule from trying to build this
46 rm contrib/linters.go
47 '';
48
49 makeFlags = [ "PREFIX=${placeholder "out"}" ];
50
51 pythonPath = [ python3Packages.vobject ];
52
53 buildInputs = [
54 python3Packages.python
55 gawk
56 bashNonInteractive
57 ]
58 ++ lib.optional withNotmuch notmuch;
59
60 installPhase = ''
61 runHook preInstall
62
63 make $makeFlags GOFLAGS="$GOFLAGS${lib.optionalString withNotmuch " -tags=notmuch"}" install
64
65 runHook postInstall
66 '';
67
68 postFixup = ''
69 wrapProgram $out/bin/aerc \
70 --prefix PATH : ${lib.makeBinPath [ ncurses ]}
71 wrapProgram $out/libexec/aerc/filters/html \
72 --prefix PATH : ${
73 lib.makeBinPath [
74 w3m
75 dante
76 ]
77 }
78 '';
79
80 nativeInstallCheckInputs = [ versionCheckHook ];
81 doInstallCheck = true;
82
83 passthru.updateScript = nix-update-script { };
84
85 meta = {
86 description = "Email client for your terminal";
87 homepage = "https://aerc-mail.org/";
88 changelog = "https://git.sr.ht/~rjarry/aerc/tree/${finalAttrs.version}/item/CHANGELOG.md";
89 maintainers = with lib.maintainers; [
90 defelo
91 sikmir
92 ];
93 mainProgram = "aerc";
94 license = lib.licenses.mit;
95 platforms = lib.platforms.unix;
96 };
97})