anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

flake.nix (5275B)


      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-26.05";
     25     systems.url = "github:nix-systems/default";
     26     gnunet.url = "git+https://git.gnunet.org/gnunet?rev=e8e7504b7ab43f7dffa25f273ff228069d8d6dd4";
     27     exchange.url = "git+https://git.gnunet.org/exchange?rev=b542c0c40c30e1ddd9b0528e913cceed8eef9c56";
     28     merchant.url = "git+https://git.gnunet.org/merchant?rev=8ca128478cf6dd8524572bf4fb344abde24ea34e";
     29     donau.url = "git+https://git.gnunet.org/donau?rev=014bf263a4f4631cfbab6486a3af069524e98ec6";
     30     anastasis.url = "git+https://git.gnunet.org/anastasis?rev=e1a886194589ece195dd5bf1030186445bacf1fb";
     31     self.submodules = true;
     32   };
     33 
     34   outputs = { self, nixpkgs, gnunet, exchange, donau, merchant, anastasis, systems, ... } @ inputs:
     35     let
     36       supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
     37       forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
     38       nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
     39     in
     40     {
     41       # This defines (installable) package derivations
     42       # For use in flakes that use this flake as input in order
     43       # to specify/use this package from git as a dependency
     44       packages = forEachSystem (system:
     45         let
     46           pkgs = nixpkgsFor.${system};
     47           gnunetpkgs = gnunet.packages.${system};
     48           exchangepkgs = exchange.packages.${system};
     49           donaupkgs = donau.packages.${system};
     50           merchantpkgs = merchant.packages.${system};
     51           anastasispkgs = anastasis.packages.${system};
     52         in {
     53           anastasisgtk = pkgs.stdenv.mkDerivation {
     54             name = "anastasis-gtk";
     55             src = ./.;
     56             nativeBuildInputs = [
     57               pkgs.gnumake
     58               pkgs.meson
     59               pkgs.ninja
     60               pkgs.pkg-config
     61              ];
     62             buildInputs = [
     63               pkgs.libtool
     64               pkgs.jansson
     65               pkgs.git
     66               pkgs.gettext
     67               pkgs.libmicrohttpd
     68               pkgs.curlWithGnuTls
     69               pkgs.qrencode
     70               pkgs.libharu
     71               pkgs.glib
     72               pkgs.gtk4
     73               gnunetpkgs.gnunet
     74               exchangepkgs.exchange
     75               donaupkgs.donau
     76               merchantpkgs.merchant
     77               anastasispkgs.anastasis
     78              ];
     79             preConfigure = ''
     80               patchShebangs --build contrib/check-prebuilt
     81               ./bootstrap
     82             '';
     83           };
     84         }
     85       );
     86       defaultPackage = forEachSystem (system: self.packages.${system}.anastasisgtk);
     87       # This defines a development shell in which you can compile
     88       # (and use) exchange
     89        devShells = forEachSystem
     90         (system:
     91           let
     92             pkgs = nixpkgsFor.${system};
     93             gnunetpkgs = gnunet.packages.${system};
     94             exchangepkgs = exchange.packages.${system};
     95             donaupkgs = donau.packages.${system};
     96             merchantpkgs = merchant.packages.${system};
     97             anastasispkgs = anastasis.packages.${system};
     98           in
     99           {
    100             default = pkgs.mkShell {
    101               packages = [
    102                 pkgs.gcc
    103                 pkgs.meson
    104                 pkgs.ninja
    105                 pkgs.gnumake
    106                 pkgs.pkg-config
    107                 pkgs.libtool
    108                 pkgs.git
    109                 pkgs.gettext
    110                 pkgs.curlWithGnuTls
    111                 gnunetpkgs.gnunet
    112                 pkgs.codespell
    113                 pkgs.clang-tools
    114                 pkgs.uncrustify
    115                 pkgs.qrencode
    116                 pkgs.libharu
    117                 pkgs.glib
    118                 pkgs.gtk4
    119                 exchangepkgs.exchange
    120                 donaupkgs.donau
    121                 merchantpkgs.merchant
    122                 anastasispkgs.anastasis
    123               ];
    124 
    125               shellHook = ''
    126                 echo "anastasis-gtk environment loaded."
    127                 export CC=gcc
    128                 export CFLAGS="-O"
    129                '';
    130             };
    131           });
    132     };
    133 }