flake.nix (2397B)
1 { 2 description = "A pure Haskell AEAD-ChaCha20-Poly1305 construction."; 3 4 inputs = { 5 ppad-base16 = { 6 type = "git"; 7 url = "git://git.ppad.tech/base16.git"; 8 ref = "master"; 9 inputs.ppad-nixpkgs.follows = "ppad-nixpkgs"; 10 }; 11 ppad-chacha = { 12 type = "git"; 13 url = "git://git.ppad.tech/chacha.git"; 14 ref = "master"; 15 inputs.ppad-nixpkgs.follows = "ppad-nixpkgs"; 16 inputs.ppad-base16.follows = "ppad-base16"; 17 }; 18 ppad-poly1305 = { 19 type = "git"; 20 url = "git://git.ppad.tech/poly1305.git"; 21 ref = "master"; 22 inputs.ppad-nixpkgs.follows = "ppad-nixpkgs"; 23 inputs.ppad-base16.follows = "ppad-base16"; 24 }; 25 ppad-nixpkgs = { 26 type = "git"; 27 url = "git://git.ppad.tech/nixpkgs.git"; 28 ref = "master"; 29 }; 30 flake-utils.follows = "ppad-nixpkgs/flake-utils"; 31 nixpkgs.follows = "ppad-nixpkgs/nixpkgs"; 32 }; 33 34 outputs = { self, nixpkgs, flake-utils, ppad-nixpkgs 35 , ppad-base16 36 , ppad-chacha, ppad-poly1305 37 }: 38 flake-utils.lib.eachDefaultSystem (system: 39 let 40 lib = "ppad-aead"; 41 42 pkgs = import nixpkgs { inherit system; }; 43 hlib = pkgs.haskell.lib; 44 45 hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: { 46 ${lib} = old.callCabal2nixWithOptions lib ./. "--enable-profiling" {}; 47 ppad-base16 = ppad-base16.packages.${system}.default; 48 ppad-chacha = ppad-chacha.packages.${system}.default; 49 ppad-poly1305 = ppad-poly1305.packages.${system}.default; 50 }); 51 52 cc = pkgs.stdenv.cc; 53 ghc = hpkgs.ghc; 54 cabal = hpkgs.cabal-install; 55 in 56 { 57 packages.default = hpkgs.${lib}; 58 59 devShells.default = hpkgs.shellFor { 60 packages = p: [ 61 (hlib.doBenchmark p.${lib}) 62 ]; 63 64 buildInputs = [ 65 cabal 66 cc 67 ]; 68 69 inputsFrom = builtins.attrValues self.packages.${system}; 70 71 doBenchmark = true; 72 73 shellHook = '' 74 PS1="[${lib}] \w$ " 75 echo "entering ${system} shell, using" 76 echo "cc: $(${cc}/bin/cc --version)" 77 echo "ghc: $(${ghc}/bin/ghc --version)" 78 echo "cabal: $(${cabal}/bin/cabal --version)" 79 ''; 80 }; 81 } 82 ); 83 } 84