2023-08-22 21:51:11 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, callPackage, stuffbin, nixosTests, fetchpatch }:
|
2022-08-05 22:41:24 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "listmonk";
|
2023-08-22 21:51:11 +00:00
|
|
|
version = "2.5.1";
|
2022-08-05 22:41:24 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "knadh";
|
|
|
|
repo = "listmonk";
|
|
|
|
rev = "v${version}";
|
2023-08-22 21:51:11 +00:00
|
|
|
sha256 = "sha256-gCnIblc83CmG1auvYYxqW/xBl6Oy1KHGkqSY/3yIm3I=";
|
2022-08-05 22:41:24 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 21:51:11 +00:00
|
|
|
patches = [
|
2023-08-27 17:28:18 +00:00
|
|
|
# Ensure that listmonk supports Go 1.20
|
2023-08-22 21:51:11 +00:00
|
|
|
(fetchpatch {
|
2023-08-27 17:28:18 +00:00
|
|
|
url = "https://github.com/knadh/listmonk/commit/25513b81044803b104ada63c0be57a913960484e.patch";
|
2023-08-22 21:51:11 +00:00
|
|
|
hash = "sha256-SYACM8r+NgeSWn9VJV4+wkm+6s/MhNGwn5zyc2tw7FU=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-09-13 04:44:46 +00:00
|
|
|
vendorHash = "sha256-0sgC1+ueZTUCP+7JwI/OKLktfMHQq959GEk1mC0TQgE=";
|
2022-08-05 22:41:24 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
stuffbin
|
|
|
|
];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/bin/cmd $out/bin/listmonk
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Run stuffbin to stuff the frontend and the static in the binary.
|
|
|
|
postFixup =
|
|
|
|
let
|
|
|
|
vfsMappings = [
|
|
|
|
"config.toml.sample"
|
|
|
|
"schema.sql"
|
|
|
|
"queries.sql"
|
|
|
|
"static/public:/public"
|
|
|
|
"static/email-templates"
|
|
|
|
"${passthru.frontend}:/admin"
|
|
|
|
"i18n:/i18n"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
''
|
|
|
|
stuffbin -a stuff -in $out/bin/listmonk -out $out/bin/listmonk \
|
|
|
|
${lib.concatStringsSep " " vfsMappings}
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
frontend = callPackage ./frontend.nix { inherit meta; };
|
2022-08-30 11:15:41 +00:00
|
|
|
tests = { inherit (nixosTests) listmonk; };
|
2022-08-05 22:41:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "High performance, self-hosted, newsletter and mailing list manager with a modern dashboard.";
|
|
|
|
homepage = "https://github.com/knadh/listmonk";
|
|
|
|
changelog = "https://github.com/knadh/listmonk/releases/tag/v${version}";
|
|
|
|
maintainers = with maintainers; [ raitobezarius ];
|
|
|
|
license = licenses.agpl3;
|
|
|
|
};
|
|
|
|
}
|