flake.nix (1475B)
1 { 2 description = "ppad-csecp256k1"; 3 4 inputs = { 5 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 6 flake-utils.url = "github:numtide/flake-utils"; 7 }; 8 9 outputs = { self, nixpkgs, flake-utils }: 10 flake-utils.lib.eachDefaultSystem (system: 11 let 12 lib = "ppad-csecp256k1"; 13 14 pkgs = import nixpkgs { inherit system; }; 15 hlib = pkgs.haskell.lib; 16 17 hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { 18 ${lib} = old.callCabal2nix lib ./. {}; 19 }); 20 21 cc = pkgs.stdenv.cc; 22 ghc = hpkgs.ghc; 23 cabal = hpkgs.cabal-install; 24 in 25 { 26 # cabal2nix disables haddock for packages with internal 27 # dependencies like secp256k1-sys, so enable it manually 28 packages.default = hlib.doHaddock hpkgs.${lib}; 29 30 devShells.default = hpkgs.shellFor { 31 packages = p: [ 32 (hlib.doBenchmark p.${lib}) 33 ]; 34 35 buildInputs = [ 36 cabal 37 cc 38 ]; 39 40 inputsFrom = builtins.attrValues self.packages.${system}; 41 42 doBenchmark = true; 43 44 shellHook = '' 45 PS1="[${lib}] \w$ " 46 echo "entering ${system} shell, using" 47 echo "cc: $(${cc}/bin/cc --version)" 48 echo "ghc: $(${ghc}/bin/ghc --version)" 49 echo "cabal: $(${cabal}/bin/cabal --version)" 50 ''; 51 }; 52 } 53 ); 54 } 55