flake.nix (1376B)
1 { 2 description = "Pure Haskell SHA-512 and HMAC-SHA512"; 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-sha512"; 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.callCabal2nixWithOptions lib ./. "--enable-profiling" {}; 19 }); 20 21 cc = pkgs.stdenv.cc; 22 ghc = hpkgs.ghc; 23 cabal = hpkgs.cabal-install; 24 in 25 { 26 packages.default = hpkgs.${lib}; 27 28 devShells.default = hpkgs.shellFor { 29 packages = p: [ 30 (hlib.doBenchmark p.${lib}) 31 ]; 32 33 buildInputs = [ 34 cabal 35 cc 36 ]; 37 38 inputsFrom = builtins.attrValues self.packages.${system}; 39 40 doBenchmark = true; 41 42 shellHook = '' 43 PS1="[${lib}] \w$ " 44 echo "entering ${system} shell, using" 45 echo "cc: $(${cc}/bin/cc --version)" 46 echo "ghc: $(${ghc}/bin/ghc --version)" 47 echo "cabal: $(${cabal}/bin/cabal --version)" 48 ''; 49 }; 50 } 51 ); 52 } 53