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


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