hmac-drbg

Pure Haskell HMAC-DRBG (docs.ppad.tech/hmac-drbg).
git clone git://git.ppad.tech/hmac-drbg.git
Log | Files | Refs | README | LICENSE

flake.nix (2120B)


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