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