flake.nix (4359B)
1 { 2 inputs = { 3 nixpkgs.url = "nixpkgs/release-25.11"; 4 systems.url = "github:nix-systems/default"; 5 gnunet.url = "git+https://git.gnunet.org/gnunet?rev=7c6b613e37e301b0e81fb94af5878d00c98e5b75"; 6 exchange.url = "git+https://git.gnunet.org/exchange?rev=92da4e81006404494f6443781c8f55249e723847"; 7 merchant.url = "git+https://git.gnunet.org/merchant?rev=b174138726171601b666fff346762502be5150a1"; 8 donau.url = "git+https://git.gnunet.org/donau?rev=4f609168fe263891f134eff01f86288066acdd81"; 9 self.submodules = true; 10 }; 11 12 outputs = { self, nixpkgs, gnunet, exchange, merchant, donau, systems, ... } @ inputs: 13 let 14 supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; 15 forEachSystem = nixpkgs.lib.genAttrs supportedSystems; 16 nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; }); 17 in 18 { 19 # This defines (installable) package derivations 20 # For use in flakes that use this flake as input in order 21 # to specify/use this package from git as a dependency 22 packages = forEachSystem (system: 23 let 24 pkgs = nixpkgsFor.${system}; 25 gnunetpkgs = gnunet.packages.${system}; 26 exchangepkgs = exchange.packages.${system}; 27 merchantpkgs = merchant.packages.${system}; 28 donaupkgs = donau.packages.${system}; 29 in { 30 sync = pkgs.stdenv.mkDerivation { 31 name = "sync"; 32 src = ./.; 33 nativeBuildInputs = [ 34 pkgs.gnumake 35 pkgs.meson 36 pkgs.ninja 37 pkgs.pkg-config 38 pkgs.python3 39 pkgs.texinfo 40 ]; 41 buildInputs = [ 42 pkgs.libtool 43 pkgs.jansson 44 pkgs.git 45 pkgs.gettext 46 pkgs.postgresql 47 (pkgs.python3.withPackages (python-pkgs: [ 48 python-pkgs.jinja2 49 ])) 50 pkgs.libmicrohttpd 51 pkgs.libsodium 52 pkgs.libgcrypt 53 pkgs.libunistring 54 pkgs.curlWithGnuTls 55 pkgs.jq 56 gnunetpkgs.gnunet 57 exchangepkgs.exchange 58 merchantpkgs.merchant 59 donaupkgs.donau 60 ]; 61 preConfigure = '' 62 patchShebangs --build contrib/check-prebuilt 63 ./bootstrap 64 ''; 65 }; 66 } 67 ); 68 defaultPackage = forEachSystem (system: self.packages.${system}.gnunet); 69 # This defines a development shell in which you can compile 70 # (and use) exchange 71 devShells = forEachSystem 72 (system: 73 let 74 pkgs = nixpkgsFor.${system}; 75 gnunetpkgs = gnunet.packages.${system}; 76 exchangepkgs = exchange.packages.${system}; 77 merchantpkgs = merchant.packages.${system}; 78 donaupkgs = donau.packages.${system}; 79 in 80 { 81 default = pkgs.mkShell { 82 packages = [ 83 pkgs.gcc 84 pkgs.meson 85 pkgs.ninja 86 pkgs.gnumake 87 pkgs.pkg-config 88 pkgs.libtool 89 pkgs.jansson 90 pkgs.git 91 pkgs.postgresql 92 pkgs.curlWithGnuTls 93 gnunetpkgs.gnunet 94 pkgs.codespell 95 pkgs.clang-tools 96 pkgs.uncrustify 97 pkgs.doxygen 98 pkgs.jq #probably not needed 99 exchangepkgs.exchange 100 merchantpkgs.merchant 101 donaupkgs.donau 102 ]; 103 104 shellHook = '' 105 echo "taler-sync environment loaded." 106 export CC=gcc 107 export CFLAGS="-O" 108 mkdir -p default 109 export PGHOST=localhost 110 export PGPORT=5432 111 export PGUSER=$USER 112 export PGDATABASE=talercheck 113 export PGDATA="$PWD/default/.pg" 114 echo $PWD 115 [ ! -d $PGDATA ] && PGHOST="$PGDATA" pg_ctl initdb -o "-U $PGUSER" 116 117 pg_ctl -o "-p $PGPORT -k $PGDATA" start && createdb talercheck && { 118 trap 'pg_ctl stop && rm -r $PGDATA' EXIT 119 } 120 ''; 121 }; 122 }); 123 }; 124 }