From 32487c13dcccf8ae7f3ba05423fab7c0140e6ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Ferech?= Date: Fri, 29 Dec 2023 19:50:17 +0100 Subject: [PATCH] taldir: init at 21-07-2022 --- pkgs/by-name/taldir/package.nix | 46 ++++++++++ pkgs/by-name/taldir/taler-go-import.patch | 103 ++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 pkgs/by-name/taldir/package.nix create mode 100644 pkgs/by-name/taldir/taler-go-import.patch diff --git a/pkgs/by-name/taldir/package.nix b/pkgs/by-name/taldir/package.nix new file mode 100644 index 00000000..51226b47 --- /dev/null +++ b/pkgs/by-name/taldir/package.nix @@ -0,0 +1,46 @@ +{ + fetchgit, + lib, + stdenv, + recutils, + buildGoModule, +}: let + version = "21-07-2022-unreleased"; +in + buildGoModule rec { + inherit version; + pname = "taldir"; + + src = fetchgit { + url = "https://git.taler.net/taldir.git"; + rev = "961875a79149e303af87b1bbb0f1fc717f275dfd"; + hash = "sha256-IMNEPo/a4pAWF5LwuAvVfM0RdEl2ztsfVGODoHNzB9E="; + leaveDotGit = true; + }; + + preBuild = '' + mkdir -p internal/gana + + pushd third_party/gana/gnu-taler-error-codes + make taler_error_codes.go + popd + + cp third_party/gana/gnu-taler-error-codes/taler_error_codes.go internal/gana/ + ''; + + vendorHash = "sha256-SrlFw30S5GAk/7OaCvQfHfppYWKB/7O7jH2z2GURcWw="; + + buildFlags = ["-mod=mod"]; + + nativeBuildInputs = [ + recutils + ]; + + patches = [./taler-go-import.patch]; + + meta = { + homepage = "https://git.taler.net/taldir.git"; + description = "Directory service to resolve wallet mailboxes by messenger addresses."; + license = lib.licenses.agpl3Plus; + }; + } diff --git a/pkgs/by-name/taldir/taler-go-import.patch b/pkgs/by-name/taldir/taler-go-import.patch new file mode 100644 index 00000000..21a9d964 --- /dev/null +++ b/pkgs/by-name/taldir/taler-go-import.patch @@ -0,0 +1,103 @@ +diff --git a/cmd/taldir-cli/main.go b/cmd/taldir-cli/main.go +index 8d62544..047f358 100644 +--- a/cmd/taldir-cli/main.go ++++ b/cmd/taldir-cli/main.go +@@ -25,8 +25,9 @@ import ( + "os" + + gnunetutil "gnunet/util" +- "taler.net/taldir/internal/util" +- taldir "taler.net/taldir/pkg/rest" ++ ++ "git.taler.net/taldir/internal/util" ++ taldir "git.taler.net/taldir/pkg/rest" + ) + + // Generates a link from a challenge and address +diff --git a/cmd/taldir-server/main.go b/cmd/taldir-server/main.go +index 9d1a1f6..67dc730 100644 +--- a/cmd/taldir-server/main.go ++++ b/cmd/taldir-server/main.go +@@ -31,7 +31,7 @@ import ( + "log" + "net/http" + +- taldir "taler.net/taldir/pkg/rest" ++ taldir "git.taler.net/taldir/pkg/rest" + ) + + var t taldir.Taldir +diff --git a/cmd/taldir-server/main_test.go b/cmd/taldir-server/main_test.go +index 3000e31..713e62e 100644 +--- a/cmd/taldir-server/main_test.go ++++ b/cmd/taldir-server/main_test.go +@@ -30,10 +30,10 @@ import ( + + gnunetutil "gnunet/util" + ++ _ "git.taler.net/taldir/cmd/taldir-server" ++ "git.taler.net/taldir/internal/util" ++ taldir "git.taler.net/taldir/pkg/rest" + "github.com/jarcoal/httpmock" +- _ "taler.net/taldir/cmd/taldir-server" +- "taler.net/taldir/internal/util" +- taldir "taler.net/taldir/pkg/rest" + ) + + var t taldir.Taldir +diff --git a/go.mod b/go.mod +index 4fec163..f39f561 100644 +--- a/go.mod ++++ b/go.mod +@@ -1,4 +1,4 @@ +-module taler.net/taldir ++module git.taler.net/taldir + + go 1.18 + +@@ -30,3 +30,5 @@ require ( + ) + + replace gnunet v0.1.27 => ./third_party/gnunet-go/src/gnunet ++ ++replace taler.net/taler-go.git => git.taler.net/taler-go.git v0.0.0-20220719135513-36eb87bf37a3 +diff --git a/internal/util/helper.go b/internal/util/helper.go +index 239980f..ba37921 100644 +--- a/internal/util/helper.go ++++ b/internal/util/helper.go +@@ -23,8 +23,9 @@ import ( + "fmt" + gnunetutil "gnunet/util" + "math/rand" +- talerutil "taler.net/taler-go.git/pkg/util" + "time" ++ ++ talerutil "git.taler.net/taler-go.git/pkg/util" + ) + + // Generates a solution from a challenge and pubkey +diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go +index 5e50edf..169b396 100644 +--- a/pkg/rest/taldir.go ++++ b/pkg/rest/taldir.go +@@ -38,16 +38,16 @@ import ( + + gnunetutil "gnunet/util" + ++ "git.taler.net/taldir/internal/gana" ++ "git.taler.net/taldir/internal/util" ++ "git.taler.net/taler-go.git/pkg/merchant" ++ tos "git.taler.net/taler-go.git/pkg/rest" + "github.com/gorilla/mux" + "github.com/skip2/go-qrcode" + "gopkg.in/ini.v1" + "gorm.io/driver/postgres" + "gorm.io/gorm" + "gorm.io/gorm/logger" +- "taler.net/taldir/internal/gana" +- "taler.net/taldir/internal/util" +- "taler.net/taler-go.git/pkg/merchant" +- tos "taler.net/taler-go.git/pkg/rest" + ) + + // Taldir is the primary object of the Taldir service