nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests }:
2
3buildGoModule rec {
4 pname = "listmonk";
5 version = "2.2.0";
6
7 src = fetchFromGitHub {
8 owner = "knadh";
9 repo = "listmonk";
10 rev = "v${version}";
11 sha256 = "sha256-dtIM0dkr8y+GbyCqrBlR5VRq6qMiZdmQyFvIoVY1eUg=";
12 };
13
14 vendorSha256 = "sha256-qeBuDM3REUxgu3ty02d7qsULH04USE0JUvBrtVnW8vg=";
15
16 nativeBuildInputs = [
17 stuffbin
18 ];
19
20 ldflags = [ "-s" "-w" "-X main.version=${version}" ];
21
22 postInstall = ''
23 mv $out/bin/cmd $out/bin/listmonk
24 '';
25
26 # Run stuffbin to stuff the frontend and the static in the binary.
27 postFixup =
28 let
29 vfsMappings = [
30 "config.toml.sample"
31 "schema.sql"
32 "queries.sql"
33 "static/public:/public"
34 "static/email-templates"
35 "${passthru.frontend}:/admin"
36 "i18n:/i18n"
37 ];
38 in
39 ''
40 stuffbin -a stuff -in $out/bin/listmonk -out $out/bin/listmonk \
41 ${lib.concatStringsSep " " vfsMappings}
42 '';
43
44 passthru = {
45 frontend = callPackage ./frontend.nix { inherit meta; };
46 tests = { inherit (nixosTests) listmonk; };
47 };
48
49 meta = with lib; {
50 description = "High performance, self-hosted, newsletter and mailing list manager with a modern dashboard.";
51 homepage = "https://github.com/knadh/listmonk";
52 changelog = "https://github.com/knadh/listmonk/releases/tag/v${version}";
53 maintainers = with maintainers; [ raitobezarius ];
54 license = licenses.agpl3;
55 };
56}