merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit dc3f3ccab28cbf19319be71d6a4a6c735444e9a6
parent 3921a989ebfefe0cbda271350d87a09c90c21970
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Thu,  9 Apr 2026 16:56:00 +0200

build: add flake

Diffstat:
Mcontrib/uncrustify_precommit | 2+-
Aflake.nix | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+), 1 deletion(-)

diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # use as .git/hooks/pre-commit exec 1>&2 diff --git a/flake.nix b/flake.nix @@ -0,0 +1,111 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/release-25.11"; + systems.url = "github:nix-systems/default"; + gnunet.url = "git+https://git.gnunet.org/gnunet?rev=7c6b613e37e301b0e81fb94af5878d00c98e5b75"; + exchange.url = "git+https://git.taler.net/exchange?rev=6c5cbfc3c55a6a86b98f3d583c6241fb3713da3c"; + self.submodules = true; + }; + + outputs = { self, nixpkgs, gnunet, systems, ... } @ inputs: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forEachSystem = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; }); + in + { + # This defines (installable) package derivations + # For use in flakes that use this flake as input in order + # to specify/use this package from git as a dependency + packages = forEachSystem (system: + let + pkgs = nixpkgsFor.${system}; + gnunetpkgs = gnunet.packages.${system}; + in { + gnunet = pkgs.stdenv.mkDerivation { + name = "merchant"; + src = ./.; + nativeBuildInputs = [ + pkgs.gnumake + pkgs.automake + pkgs.autoconf + pkgs.pkg-config + pkgs.python3 + pkgs.texinfo + ]; + buildInputs = [ + pkgs.libtool + pkgs.jansson + pkgs.git + pkgs.gettext + pkgs.postgresql + (pkgs.python3.withPackages (python-pkgs: [ + python-pkgs.jinja2 + ])) + pkgs.libmicrohttpd + pkgs.libsodium + pkgs.libgcrypt + pkgs.libunistring + pkgs.curlWithGnuTls + pkgs.jq + gnunetpkgs.gnunet + ]; + preConfigure = '' + patchShebangs --build contrib/check-prebuilt + ./bootstrap + ''; + }; + } + ); + defaultPackage = forEachSystem (system: self.packages.${system}.gnunet); + # This defines a development shell in which you can compile + # (and use) exchange + devShells = forEachSystem + (system: + let + pkgs = nixpkgsFor.${system}; + gnunetpkgs = gnunet.packages.${system}; + in + { + default = pkgs.mkShell { + packages = [ + pkgs.gcc + pkgs.meson + pkgs.ninja + pkgs.gnumake + pkgs.texinfo + pkgs.pkg-config + pkgs.libtool + pkgs.jansson + pkgs.git + pkgs.gettext + pkgs.postgresql + pkgs.curlWithGnuTls + gnunetpkgs.gnunet + pkgs.codespell + pkgs.clang-tools + pkgs.uncrustify + pkgs.doxygen + ]; + + shellHook = '' + echo "taler-merchant environment loaded." + export CC=gcc + export CFLAGS="-O" + mkdir -p default + export PGHOST=localhost + export PGPORT=5432 + export PGUSER=$USER + export PGDATABASE=talercheck + export PGDATA="$PWD/default/.pg" + echo $PWD + [ ! -d $PGDATA ] && PGHOST="$PGDATA" pg_ctl initdb -o "-U $PGUSER" + + pg_ctl -o "-p $PGPORT -k $PGDATA" start && createdb talercheck && { + trap 'pg_ctl stop && rm -r $PGDATA' EXIT + } + ''; + }; + }); + }; +}