btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / ta / taler-merchant / package.nix
blob60350fcf57946ae78bd416527e52012d4c94bac6
2   lib,
3   stdenv,
4   fetchgit,
5   gnunet,
6   qrencode,
7   taler-exchange,
8   taler-wallet-core,
9   libtool,
10   pkg-config,
11   autoreconfHook,
12   makeWrapper,
13   jq,
16 stdenv.mkDerivation (finalAttrs: {
17   pname = "taler-merchant";
18   version = "0.13.0";
20   src = fetchgit {
21     url = "https://git.taler.net/merchant.git";
22     rev = "v${finalAttrs.version}";
23     fetchSubmodules = true;
24     hash = "sha256-N3atOOE21OEks3G1LPOM5qo/kq0D5D9gmTfURCBZx6M=";
25   };
27   postUnpack = ''
28     ln -s ${taler-wallet-core}/spa.html $sourceRoot/contrib/
29   '';
31   # Use an absolute path for `templates` and `spa` directories, else a relative
32   # path to the `taler-exchange` package is used.
33   postPatch = ''
34     substituteInPlace src/backend/taler-merchant-httpd.c \
35       --replace-fail 'TALER_TEMPLATING_init ("merchant");' "TALER_TEMPLATING_init_path (\"merchant\", \"$out/share/taler\");"
37     substituteInPlace src/backend/taler-merchant-httpd_spa.c \
38       --replace-fail 'GNUNET_DISK_directory_scan (dn,' "GNUNET_DISK_directory_scan (\"$out/share/taler/merchant/spa/\","
39   '';
41   nativeBuildInputs = [
42     pkg-config
43     autoreconfHook
44     makeWrapper
45   ];
47   buildInputs = taler-exchange.buildInputs ++ [
48     qrencode
49     taler-exchange
50     # for ltdl.h
51     libtool
52   ];
54   propagatedBuildInputs = [ gnunet ];
56   # From ./bootstrap
57   preAutoreconf = ''
58     pushd contrib
59     find wallet-core/backoffice/ -type f -printf '  %p \\\n' | sort > Makefile.am.ext
60     truncate -s -2 Makefile.am.ext
61     cat Makefile.am.in Makefile.am.ext >> Makefile.am
62     popd
63   '';
65   # NOTE: The executables that need database access fail to detect the
66   # postgresql library in `$out/lib/taler`, so we need to wrap them.
67   postInstall = ''
68     for exec in dbinit httpd webhook wirewatch depositcheck exchange; do
69       wrapProgram $out/bin/taler-merchant-$exec \
70         --prefix LD_LIBRARY_PATH : "$out/lib/taler"
71     done
72   '';
74   enableParallelBuilding = true;
76   doInstallCheck = true;
78   nativeCheckInputs = [ jq ];
80   checkTarget = "check";
82   meta = {
83     description = ''
84       This is the GNU Taler merchant backend. It provides the logic that should run
85       at every GNU Taler merchant.  The GNU Taler merchant is a RESTful backend that
86       can be used to setup orders and process payments.  This component allows
87       merchants to receive payments without invading the customers' privacy. Of
88       course, this applies mostly for digital goods, as the merchant does not need
89       to know the customer's physical address.
90     '';
91     homepage = "https://taler.net/";
92     changelog = "https://git.taler.net/merchant.git/tree/ChangeLog";
93     license = lib.licenses.agpl3Plus;
94     maintainers = with lib.maintainers; [ astro ];
95     platforms = lib.platforms.linux;
96   };