secp256k1

Pure Haskell Schnorr, ECDSA on the elliptic curve secp256k1 (docs.ppad.tech/secp256k1).
git clone git://git.ppad.tech/secp256k1.git
Log | Files | Refs | README | LICENSE

flake.nix (2787B)


      1 {
      2   description = "Pure Haskell Schnorr, ECDSA on secp256k1";
      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     ppad-sha512 = {
     23       type = "git";
     24       url  = "git://git.ppad.tech/sha512.git";
     25       ref  = "master";
     26       inputs.ppad-nixpkgs.follows = "ppad-nixpkgs";
     27     };
     28     ppad-hmac-drbg = {
     29       type = "git";
     30       url  = "git://git.ppad.tech/hmac-drbg.git";
     31       ref  = "master";
     32       inputs.ppad-sha256.follows = "ppad-sha256";
     33       inputs.ppad-sha512.follows = "ppad-sha512";
     34       inputs.ppad-nixpkgs.follows = "ppad-nixpkgs";
     35     };
     36     flake-utils.follows = "ppad-nixpkgs/flake-utils";
     37     nixpkgs.follows = "ppad-nixpkgs/nixpkgs";
     38   };
     39 
     40   outputs = { self, nixpkgs, flake-utils, ppad-nixpkgs
     41             , ppad-base16
     42             , ppad-sha256, ppad-sha512
     43             , ppad-hmac-drbg
     44             }:
     45     flake-utils.lib.eachDefaultSystem (system:
     46       let
     47         lib = "ppad-secp256k1";
     48 
     49         pkgs = import nixpkgs { inherit system; };
     50         hlib = pkgs.haskell.lib;
     51 
     52         base16 = ppad-base16.packages.${system}.default;
     53         sha256 = ppad-sha256.packages.${system}.default;
     54         hmac-drbg = ppad-hmac-drbg.packages.${system}.default;
     55 
     56         hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: {
     57           ppad-base16 = base16;
     58           ppad-sha256 = sha256;
     59           ppad-hmac-drbg = hmac-drbg;
     60           ${lib} = new.callCabal2nix lib ./. {
     61             ppad-base16 = new.ppad-base16;
     62             ppad-sha256 = new.ppad-sha256;
     63             ppad-hmac-drbg = new.ppad-hmac-drbg;
     64           };
     65         });
     66 
     67         cc    = pkgs.stdenv.cc;
     68         ghc   = hpkgs.ghc;
     69         cabal = hpkgs.cabal-install;
     70       in
     71         {
     72           packages.default = hpkgs.${lib};
     73 
     74           devShells.default = hpkgs.shellFor {
     75             packages = p: [
     76               (hlib.doBenchmark p.${lib})
     77             ];
     78 
     79             buildInputs = [
     80               cabal
     81               cc
     82             ];
     83 
     84             inputsFrom = builtins.attrValues self.packages.${system};
     85 
     86             doBenchmark = true;
     87 
     88             shellHook = ''
     89               PS1="[${lib}] \w$ "
     90               echo "entering ${system} shell, using"
     91               echo "cc:    $(${cc}/bin/cc --version)"
     92               echo "ghc:   $(${ghc}/bin/ghc --version)"
     93               echo "cabal: $(${cabal}/bin/cabal --version)"
     94             '';
     95           };
     96         }
     97       );
     98 }
     99