Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNU Taler #255

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions pkgs/by-name/depolymerization/0001-Fix-status-test-docs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Subject: [PATCH] Fix status test docs

---
common/src/status.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/src/status.rs b/common/src/status.rs
index bc7d2f3..f98cd4a 100644
--- a/common/src/status.rs
+++ b/common/src/status.rs
@@ -17,7 +17,7 @@

/// Debit transaction status
///
-/// -> Requested API request
+/// () -> Requested API request
/// Requested -> Sent Announced to the bitcoin network
/// Sent -> Requested Conflicting transaction (reorg)
#[repr(u8)]
@@ -43,7 +43,7 @@ impl TryFrom<u8> for DebitStatus {

/// Bounce transaction status
///
-/// -> Requested Credit in wrong format
+/// () -> Requested Credit in wrong format
/// Requested -> Ignored Insufficient found
/// Requested -> Sent Announced to the bitcoin network
/// Sent -> Requested Conflicting transaction (reorg)
--
2.44.0

34 changes: 34 additions & 0 deletions pkgs/by-name/depolymerization/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
lib,
rustPlatform,
fetchgit,
stdenv,
darwin,
}:
rustPlatform.buildRustPackage {
pname = "depolymerization";
version = "0-unstable-2024-03-18";

src = fetchgit {
url = "https://git.taler.net/depolymerization.git/";
rev = "80ded0febe5acbfa64cef3d84846b4a1300ea97f";
hash = "sha256-wb1IxaiM+uGEa9l8Iz0fDluIWZgVMnT8BUZ/R5M3dcU=";
};

cargoHash = "sha256-aU4edNBxQfzFAdAbY5mkw9xl9pcC6ao027HakNX9BW8=";

patches = [./0001-Fix-status-test-docs.patch];

buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];

meta = with lib; {
description = "Wire gateway for Bitcoin/Ethereum";
homepage = "https://git.taler.net/depolymerization.git/";
license = licenses.agpl3Only;
maintainers = with maintainers; [];
};
}
27 changes: 27 additions & 0 deletions pkgs/by-name/taler-mailbox/0001-Use-the-existing-mailbox.patch
Original file line number Diff line number Diff line change
@@ -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

17 changes: 17 additions & 0 deletions pkgs/by-name/taler-mailbox/example.conf
Original file line number Diff line number Diff line change
@@ -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"
38 changes: 38 additions & 0 deletions pkgs/by-name/taler-mailbox/package.nix
Original file line number Diff line number Diff line change
@@ -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";
};
}
82 changes: 28 additions & 54 deletions pkgs/by-name/taler-wallet-core/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
fetchgit,
git,
jq,
moreutils,
nodePackages,
cacert,
nodejs,
python3,
zip,
pnpm,
removeReferencesTo,
srcOnly,
}: let
nodePackages = nodejs.pkgs;
nodeSources = srcOnly nodejs;
esbuild_0_19_9 = buildGoModule rec {
pname = "esbuild";
version = "0.19.9";
Expand All @@ -38,8 +41,9 @@
mainProgram = "esbuild";
};
};
taler-wallet-core-pnpm-deps = stdenv.mkDerivation rec {
pname = "taler-wallet-core-pnpm-deps";
in
stdenv.mkDerivation rec {
pname = "taler-wallet-core";
version = "0.11.2";

src = fetchgit {
Expand All @@ -48,60 +52,23 @@
hash = "sha256-GtR87XqmunYubh9EiY3bJIqXiXrT+re3KqWypYK3NCo=";
};

nativeBuildInputs = [
jq
moreutils
nodePackages.pnpm
cacert
];

dontBuild = true;

installPhase = ''
runHook preInstall

export HOME=$(mktemp -d)

pnpm config set store-dir $out
pnpm install --frozen-lockfile --ignore-script

rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done

runHook postInstall
'';

dontFixup = true;

outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash =
{
aarch64-linux = "sha256-8n/vM4RVyfbYf34i5CtlI/Hj9LGZtCpgYVnOvBZI7x4=";
x86_64-linux = "sha256-gsWbzFNy/bH+MLisiRms+sjF0fIdbChFbWjbhl8eA+Q=";
}
.${stdenv.system}
or (throw "Unsupported system: ${stdenv.system}");
};
in
stdenv.mkDerivation {
pname = "taler-wallet-core";
inherit (taler-wallet-core-pnpm-deps) version src;

nativeBuildInputs = [
git
jq
nodePackages.nodejs
nodePackages.pnpm
pnpm.configHook
python3
zip
];

pnpmDeps = pnpm.fetchDeps {
inherit pname version src;
hash = "sha256-RdG/QnZNIvQIMU7ScSFz2OfbctHBr65GWXLPvVaybfQ=";
};

buildInputs = [nodePackages.nodejs];

# Use a fake git?
postUnpack = ''
git init -b master
git config user.email "root@localhost"
Expand All @@ -119,12 +86,19 @@ in
./bootstrap
'';

# After the pnpm configure, we need to build the binaries of all instances
# of better-sqlite3. It has a native part that it wants to build using a
# script which is disallowed.
# Adapted from mkYarnModules.
preBuild = ''
export HOME=$(mktemp -d)

pnpm config set store-dir ${taler-wallet-core-pnpm-deps}
pnpm install --offline --frozen-lockfile --ignore-script
patchShebangs node_modules/{*,.*}
for f in $(find -path '*/node_modules/better-sqlite3' -type d); do
(cd "$f" && (
npm run build-release --offline --nodedir="${nodeSources}"
find build -type f -exec \
${removeReferencesTo}/bin/remove-references-to \
-t "${nodeSources}" {} \;
))
done
'';

env.ESBUILD_BINARY_PATH = lib.getExe esbuild_0_19_9;
Expand Down