flake.nix (2834B)
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 cc = pkgs.stdenv.cc; 69 ghc = hpkgs.ghc; 70 cabal = hpkgs.cabal-install; 71 in 72 { 73 packages.default = hpkgs.${lib}; 74 75 devShells.default = hpkgs.shellFor { 76 packages = p: [ 77 (hlib.doBenchmark p.${lib}) 78 ]; 79 80 buildInputs = [ 81 cabal 82 cc 83 ]; 84 85 inputsFrom = builtins.attrValues self.packages.${system}; 86 87 doBenchmark = true; 88 89 shellHook = '' 90 PS1="[${lib}] \w$ " 91 echo "entering ${system} shell, using" 92 echo "cc: $(${cc}/bin/cc --version)" 93 echo "ghc: $(${ghc}/bin/ghc --version)" 94 echo "cabal: $(${cabal}/bin/cabal --version)" 95 ''; 96 }; 97 } 98 ); 99 } 100