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 (2275B)


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