anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

flake.nix (5046B)


      1 # This is a nix flake. To use it, you need nix (with flake support) installed.
      2 # If you do not have nix and do not intend to use it, you can ignore this file.
      3 # Why should you use it? Using this flake will allow you to enter a developer shell
      4 # which has all necessary packages for this repository already installed.
      5 # The shell will allow you to code against the specific revisions of the dependencies
      6 # pinned in this file.
      7 # This is useful when git HEAD of your dependencies already contains breaking changes
      8 # you should not (yet) code against.
      9 # OTOH, if you should code against a newer, not yet released revision, you can specify
     10 # this revision in this file.
     11 # You can use this file in three ways:
     12 # 1. Build: $ nix build
     13 # this will build the package (it runs make for you in an environment with the dependencies installed)
     14 # 2. Develop: $ nix develop
     15 # This will drop you inside a shell in which you can develop and compile (and test) your code.
     16 # It even starts and sets up the test database for you.
     17 # 3. Use this repository in a new project
     18 # Should you create a new project that depends on this project you are in luck. You can create a flake.nix
     19 # in your repository and include this packages as a dependency just like the dependencies of this package are
     20 # included here.
     21 
     22 {
     23   inputs = {
     24     nixpkgs.url = "nixpkgs/release-25.11";
     25     systems.url = "github:nix-systems/default";
     26     gnunet.url = "git+https://git.gnunet.org/gnunet?rev=7c6b613e37e301b0e81fb94af5878d00c98e5b75";
     27     exchange.url = "git+https://git.gnunet.org/exchange?rev=92da4e81006404494f6443781c8f55249e723847";
     28     merchant.url = "git+https://git.gnunet.org/merchant?rev=b174138726171601b666fff346762502be5150a1";
     29     donau.url = "git+https://git.gnunet.org/donau?rev=4f609168fe263891f134eff01f86288066acdd81";
     30     self.submodules = true;
     31   };
     32 
     33   outputs = { self, nixpkgs, gnunet, exchange, donau, merchant, systems, ... } @ inputs:
     34     let
     35       supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
     36       forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
     37       nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
     38     in
     39     {
     40       # This defines (installable) package derivations
     41       # For use in flakes that use this flake as input in order
     42       # to specify/use this package from git as a dependency
     43       packages = forEachSystem (system:
     44         let
     45           pkgs = nixpkgsFor.${system};
     46           gnunetpkgs = gnunet.packages.${system};
     47           exchangepkgs = exchange.packages.${system};
     48           donaupkgs = donau.packages.${system};
     49           merchantpkgs = merchant.packages.${system};
     50         in {
     51           anastasis = pkgs.stdenv.mkDerivation {
     52             name = "anastasis";
     53             src = ./.;
     54             nativeBuildInputs = [
     55               pkgs.gnumake
     56               pkgs.meson
     57               pkgs.ninja
     58               pkgs.pkg-config
     59              ];
     60             buildInputs = [
     61               pkgs.libtool
     62               pkgs.jansson
     63               pkgs.git
     64               pkgs.libmicrohttpd
     65               pkgs.libsodium
     66               pkgs.libgcrypt
     67               pkgs.curlWithGnuTls
     68               pkgs.qrencode
     69               gnunetpkgs.gnunet
     70               exchangepkgs.exchange
     71               donaupkgs.donau
     72               merchantpkgs.merchant
     73              ];
     74             preConfigure = ''
     75               patchShebangs --build contrib/check-prebuilt
     76               ./bootstrap
     77             '';
     78           };
     79         }
     80       );
     81       defaultPackage = forEachSystem (system: self.packages.${system}.anastasis);
     82       # This defines a development shell in which you can compile
     83       # (and use) exchange
     84        devShells = forEachSystem
     85         (system:
     86           let
     87             pkgs = nixpkgsFor.${system};
     88             gnunetpkgs = gnunet.packages.${system};
     89             exchangepkgs = exchange.packages.${system};
     90             donaupkgs = donau.packages.${system};
     91             merchantpkgs = merchant.packages.${system};
     92           in
     93           {
     94             default = pkgs.mkShell {
     95               packages = [
     96                 pkgs.gcc
     97                 pkgs.meson
     98                 pkgs.ninja
     99                 pkgs.gnumake
    100                 pkgs.texinfo
    101                 pkgs.pkg-config
    102                 pkgs.libtool
    103                 pkgs.jansson
    104                 pkgs.git
    105                 pkgs.gettext
    106                 pkgs.postgresql
    107                 pkgs.curlWithGnuTls
    108                 gnunetpkgs.gnunet
    109                 pkgs.codespell
    110                 pkgs.clang-tools
    111                 pkgs.uncrustify
    112                 pkgs.jq #probably not needed
    113                 pkgs.doxygen
    114                 pkgs.typst
    115                 pkgs.pdftk
    116                 pkgs.qrencode
    117                 exchangepkgs.exchange
    118                 donaupkgs.donau
    119                 merchantpkgs.merchant
    120               ];
    121 
    122               shellHook = ''
    123                 echo "anastasis environment loaded."
    124                 export CC=gcc
    125                 export CFLAGS="-O"
    126                '';
    127             };
    128           });
    129     };
    130 }