-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
89 lines (77 loc) · 2.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
description = "Pure Haskell Schnorr, ECDSA on secp256k1";
inputs = {
ppad-nixpkgs = {
type = "git";
url = "git://git.ppad.tech/nixpkgs.git";
ref = "master";
};
ppad-sha256 = {
type = "git";
url = "git://git.ppad.tech/sha256.git";
ref = "master";
inputs.ppad-nixpkgs.follows = "ppad-nixpkgs";
};
ppad-sha512 = {
type = "git";
url = "git://git.ppad.tech/sha512.git";
ref = "master";
inputs.ppad-nixpkgs.follows = "ppad-nixpkgs";
};
ppad-hmac-drbg = {
type = "git";
url = "git://git.ppad.tech/hmac-drbg.git";
ref = "master";
inputs.ppad-sha256.follows = "ppad-sha256";
inputs.ppad-sha512.follows = "ppad-sha512";
inputs.ppad-nixpkgs.follows = "ppad-nixpkgs";
};
flake-utils.follows = "ppad-nixpkgs/flake-utils";
nixpkgs.follows = "ppad-nixpkgs/nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, ppad-nixpkgs
, ppad-sha256, ppad-sha512
, ppad-hmac-drbg
}:
flake-utils.lib.eachDefaultSystem (system:
let
lib = "ppad-secp256k1";
pkgs = import nixpkgs { inherit system; };
hlib = pkgs.haskell.lib;
sha256 = ppad-sha256.packages.${system}.default;
hmac-drbg = ppad-hmac-drbg.packages.${system}.default;
hpkgs = pkgs.haskell.packages.ghc981.extend (new: old: {
ppad-sha256 = sha256;
ppad-hmac-drbg = hmac-drbg;
${lib} = new.callCabal2nix lib ./. {
ppad-sha256 = new.ppad-sha256;
ppad-hmac-drbg = new.ppad-hmac-drbg;
};
});
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)"
'';
};
}
);
}