From 7ff4e70ee59c65505585045e3f58365dd9450b52 Mon Sep 17 00:00:00 2001 From: eljamm Date: Sun, 2 Jun 2024 22:10:27 +0100 Subject: [PATCH] taler-mailbox: init at 0-unstable-2022-07-20 --- .../0001-Use-the-existing-mailbox.patch | 27 +++++++++++++ pkgs/by-name/taler-mailbox/example.conf | 17 +++++++++ pkgs/by-name/taler-mailbox/package.nix | 38 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch create mode 100644 pkgs/by-name/taler-mailbox/example.conf create mode 100644 pkgs/by-name/taler-mailbox/package.nix diff --git a/pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch b/pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch new file mode 100644 index 00000000..0d4b63c4 --- /dev/null +++ b/pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch @@ -0,0 +1,27 @@ +Subject: [PATCH] Use the existing mailbox and don't create a new one + +It's wrong to re-declare a new mailbox inside the main function +since a global one is already defined. + +This is because if the global mailbox is not initialized, the +program will panic whenever we try to read a key from the config. +--- + cmd/mailbox-server/main.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmd/mailbox-server/main.go b/cmd/mailbox-server/main.go +index 070b7af..458c401 100644 +--- a/cmd/mailbox-server/main.go ++++ b/cmd/mailbox-server/main.go +@@ -40,7 +40,7 @@ func main() { + if len(*cfgFlag) != 0 { + cfgfile = *cfgFlag + } +- m := mailbox.Mailbox{} ++ m = mailbox.Mailbox{} + m.Initialize(cfgfile) + handleRequests() + } +-- +2.44.0 + diff --git a/pkgs/by-name/taler-mailbox/example.conf b/pkgs/by-name/taler-mailbox/example.conf new file mode 100644 index 00000000..e93b2556 --- /dev/null +++ b/pkgs/by-name/taler-mailbox/example.conf @@ -0,0 +1,17 @@ +[mailbox] +production = false +host = "https://taler-mailbox.gnunet.org" +bind_to = "localhost:11000" +message_fee = KUDOS:1 +default_doc_filetype = text/html +default_doc_lang = en +default_tos_path = terms/ +default_pp_path = privacy/ +supported_doc_filetypes = text/html application/pdf application/epub application/xml text/plain + +[mailbox-pq] +host = "localhost" +port = 5432 +user = "taler-mailbox" +password = "secret" +db_name = "taler-mailbox" diff --git a/pkgs/by-name/taler-mailbox/package.nix b/pkgs/by-name/taler-mailbox/package.nix new file mode 100644 index 00000000..212f576a --- /dev/null +++ b/pkgs/by-name/taler-mailbox/package.nix @@ -0,0 +1,38 @@ +{ + lib, + buildGoModule, + fetchgit, +}: +buildGoModule { + pname = "taler-mailbox"; + version = "0-unstable-2022-07-20"; + + src = fetchgit { + url = "https://git.taler.net/taler-mailbox.git"; + rev = "ee5c19e9edf7e4e0959becc99e97606d9e6de041"; + hash = "sha256-t5IE8CuAKT5qlCNIqG9m8Gw0zJHa7505wHNK2ENuRQU="; + }; + + vendorHash = "sha256-frrmhfCcbY5DpCxR2g6HeSfN7xuLxpAWRahQl140voI="; + + patches = [ + ./0001-Use-the-existing-mailbox.patch + ]; + + postInstall = '' + install ./configs/mailbox-example.conf -Dt $out/share/examples/taler-mailbox + ''; + + ldflags = [ + "-s" + "-w" + ]; + + meta = with lib; { + description = "Service for asynchronous wallet-to-wallet payment messages"; + homepage = "https://git.taler.net/taler-mailbox.git"; + license = licenses.agpl3Only; + maintainers = with maintainers; []; + mainProgram = "mailbox-server"; + }; +}