btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / li / listmonk / package.nix
bloba796a4ac5f31426b8339ba51498722970e9a5ae3
1 { lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests }:
3 buildGoModule rec {
4   pname = "listmonk";
5   version = "3.0.0";
7   src = fetchFromGitHub {
8     owner = "knadh";
9     repo = "listmonk";
10     rev = "v${version}";
11     hash = "sha256-eNX+2ens+mz2V8ZBHtFFHDVbi64AAiiREElMjh67Dd8=";
12   };
14   vendorHash = "sha256-XAm2VfX1nHWTuAV2COEn8qrqPNv0xbaWgTYCpjrEfMw=";
16   nativeBuildInputs = [
17     stuffbin
18   ];
20   ldflags = [ "-s" "-w" "-X main.version=${version}" ];
22   postInstall = ''
23     mv $out/bin/cmd $out/bin/listmonk
24   '';
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       '';
44   passthru = {
45     frontend = callPackage ./frontend.nix { inherit meta version src; };
46     tests = { inherit (nixosTests) listmonk; };
47   };
49   meta = with lib; {
50     description = "High performance, self-hosted, newsletter and mailing list manager with a modern dashboard";
51     mainProgram = "listmonk";
52     homepage = "https://github.com/knadh/listmonk";
53     changelog = "https://github.com/knadh/listmonk/releases/tag/v${version}";
54     maintainers = with maintainers; [ raitobezarius ];
55     license = licenses.agpl3Only;
56   };