csecp256k1

Haskell FFI bindings to bitcoin-core/secp256k1 (docs.ppad.tech/csecp256k1).
git clone git://git.ppad.tech/csecp256k1.git
Log | Files | Refs | README | LICENSE

flake.nix (1736B)


      1 {
      2   description = "ppad-csecp256k1";
      3 
      4   inputs = {
      5     ppad-sha256 = {
      6       type = "git";
      7       url  = "git://git.ppad.tech/sha256.git";
      8       ref  = "master";
      9     };
     10     flake-utils.follows = "ppad-sha256/flake-utils";
     11     nixpkgs.follows = "ppad-sha256/nixpkgs";
     12   };
     13 
     14   outputs = { self, nixpkgs, flake-utils, ppad-sha256 }:
     15     flake-utils.lib.eachDefaultSystem (system:
     16       let
     17         lib = "ppad-csecp256k1";
     18 
     19         pkgs = import nixpkgs { inherit system; };
     20         hlib = pkgs.haskell.lib;
     21 
     22         sha256 = ppad-sha256.packages.${system}.default;
     23 
     24         hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: {
     25           ppad-sha256 = sha256;
     26           ${lib} = new.callCabal2nix lib ./. {
     27             ppad-sha256 = new.ppad-sha256;
     28           };
     29         });
     30 
     31         cc    = pkgs.stdenv.cc;
     32         ghc   = hpkgs.ghc;
     33         cabal = hpkgs.cabal-install;
     34       in
     35         {
     36           # cabal2nix disables haddock for packages with internal
     37           # dependencies like secp256k1-sys, so enable it manually
     38           packages.default = hlib.doHaddock hpkgs.${lib};
     39 
     40           devShells.default = hpkgs.shellFor {
     41             packages = p: [
     42               (hlib.doBenchmark p.${lib})
     43             ];
     44 
     45             buildInputs = [
     46               cabal
     47               cc
     48             ];
     49 
     50             inputsFrom = builtins.attrValues self.packages.${system};
     51 
     52             doBenchmark = true;
     53 
     54             shellHook = ''
     55               PS1="[${lib}] \w$ "
     56               echo "entering ${system} shell, using"
     57               echo "cc:    $(${cc}/bin/cc --version)"
     58               echo "ghc:   $(${ghc}/bin/ghc --version)"
     59               echo "cabal: $(${cabal}/bin/cabal --version)"
     60             '';
     61           };
     62         }
     63       );
     64 }
     65