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