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