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 (1869B)


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