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