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


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