flake.nix (2438B)
1 { 2 description = "Pure Haskell PBKDF functions."; 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 ppad-sha512 = { 23 type = "git"; 24 url = "git://git.ppad.tech/sha512.git"; 25 ref = "master"; 26 inputs.ppad-nixpkgs.follows = "ppad-nixpkgs"; 27 }; 28 flake-utils.follows = "ppad-nixpkgs/flake-utils"; 29 nixpkgs.follows = "ppad-nixpkgs/nixpkgs"; 30 }; 31 32 outputs = { self, nixpkgs, flake-utils, ppad-nixpkgs 33 , ppad-sha256, ppad-sha512 34 , ppad-base16 }: 35 flake-utils.lib.eachDefaultSystem (system: 36 let 37 lib = "ppad-pbkdf"; 38 39 pkgs = import nixpkgs { inherit system; }; 40 hlib = pkgs.haskell.lib; 41 42 base16 = ppad-base16.packages.${system}.default; 43 sha256 = ppad-sha256.packages.${system}.default; 44 sha512 = ppad-sha512.packages.${system}.default; 45 46 hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { 47 ppad-base16 = base16; 48 ppad-sha256 = sha256; 49 ppad-sha512 = sha512; 50 ${lib} = new.callCabal2nix lib ./. { 51 ppad-base16 = new.ppad-base16; 52 ppad-sha256 = new.ppad-sha256; 53 ppad-sha512 = new.ppad-sha512; 54 }; 55 }); 56 57 cc = pkgs.stdenv.cc; 58 ghc = hpkgs.ghc; 59 cabal = hpkgs.cabal-install; 60 in 61 { 62 packages.default = hpkgs.${lib}; 63 64 devShells.default = hpkgs.shellFor { 65 packages = p: [ 66 (hlib.doBenchmark p.${lib}) 67 ]; 68 69 buildInputs = [ 70 cabal 71 cc 72 ]; 73 74 inputsFrom = builtins.attrValues self.packages.${system}; 75 76 doBenchmark = true; 77 78 shellHook = '' 79 PS1="[${lib}] \w$ " 80 echo "entering ${system} shell, using" 81 echo "cc: $(${cc}/bin/cc --version)" 82 echo "ghc: $(${ghc}/bin/ghc --version)" 83 echo "cabal: $(${cabal}/bin/cabal --version)" 84 ''; 85 }; 86 } 87 ); 88 } 89