flake.nix (1901B)
1 { 2 description = "Pure Haskell Schnorr, ECDSA on secp256k1"; 3 4 inputs = { 5 ppad-sha256 = { 6 type = "git"; 7 url = "git://git.ppad.tech/sha256.git"; 8 ref = "master"; 9 }; 10 ppad-hmac-drbg = { 11 type = "git"; 12 url = "git://git.ppad.tech/hmac-drbg.git"; 13 ref = "master"; 14 }; 15 flake-utils.follows = "ppad-sha256/flake-utils"; 16 nixpkgs.follows = "ppad-sha256/nixpkgs"; 17 }; 18 19 outputs = { self, nixpkgs, flake-utils, ppad-sha256, ppad-hmac-drbg }: 20 flake-utils.lib.eachDefaultSystem (system: 21 let 22 lib = "ppad-secp256k1"; 23 24 pkgs = import nixpkgs { inherit system; }; 25 hlib = pkgs.haskell.lib; 26 27 sha256 = ppad-sha256.packages.${system}.default; 28 hmac-drbg = ppad-hmac-drbg.packages.${system}.default; 29 30 hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { 31 ppad-sha256 = sha256; 32 ppad-hmac-drbg = hmac-drbg; 33 ${lib} = new.callCabal2nix lib ./. { 34 ppad-sha256 = new.ppad-sha256; 35 ppad-hmac-drbg = new.ppad-hmac-drbg; 36 }; 37 }); 38 39 cc = pkgs.stdenv.cc; 40 ghc = hpkgs.ghc; 41 cabal = hpkgs.cabal-install; 42 in 43 { 44 packages.default = hpkgs.${lib}; 45 46 devShells.default = hpkgs.shellFor { 47 packages = p: [ 48 (hlib.doBenchmark p.${lib}) 49 ]; 50 51 buildInputs = [ 52 cabal 53 cc 54 ]; 55 56 inputsFrom = builtins.attrValues self.packages.${system}; 57 58 doBenchmark = true; 59 60 shellHook = '' 61 PS1="[${lib}] \w$ " 62 echo "entering ${system} shell, using" 63 echo "cc: $(${cc}/bin/cc --version)" 64 echo "ghc: $(${ghc}/bin/ghc --version)" 65 echo "cabal: $(${cabal}/bin/cabal --version)" 66 ''; 67 }; 68 } 69 ); 70 } 71