This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmodule.nix
154 lines (151 loc) · 4.06 KB
/
module.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{ inputs }:
{ lib, config, pkgs, haskellLib, ... }:
let
pkgs' = inputs.nixpkgs.legacyPackages.${pkgs.system};
# https://github.com/input-output-hk/haskell.nix/issues/1177
nonReinstallablePkgs = [
"array"
"base"
"binary"
"bytestring"
"Cabal"
"containers"
"deepseq"
"directory"
"exceptions"
"filepath"
"ghc"
"ghc-bignum"
"ghc-boot"
"ghc-boot"
"ghc-boot-th"
"ghc-compact"
"ghc-heap"
# "ghci"
# "haskeline"
"ghcjs-prim"
"ghcjs-th"
"ghc-prim"
"ghc-prim"
"hpc"
"integer-gmp"
"integer-simple"
"mtl"
"parsec"
"pretty"
"process"
"rts"
"stm"
"template-haskell"
"terminfo"
"text"
"time"
"transformers"
"unix"
"Win32"
"xhtml"
];
brokenLibsModule =
let
responseFile = builtins.toFile "response-file" ''
--optghc=-XFlexibleContexts
--optghc=-Wwarn
--optghc=-fplugin-opt=PlutusTx.Plugin:defer-errors
'';
l = [
"cardano-binary"
"cardano-crypto-class"
"cardano-crypto-praos"
"cardano-prelude"
"heapwords"
"measures"
"strict-containers"
"cardano-ledger-byron"
"cardano-slotting"
];
in
{
_file = "mlabs-tooling.nix/module.nix:brokenLibsModule";
packages = builtins.listToAttrs (builtins.map
(name: {
inherit name;
value.components.library.setupHaddockFlags = [ "--haddock-options=@${responseFile}" ];
value.components.library.ghcOptions = [ "-XFlexibleContexts" "-Wwarn" "-fplugin-opt=PlutusTx.Plugin:defer-errors" ];
value.components.library.extraSrcFiles = [ responseFile ];
})
l);
};
module = { config, pkgs, hsPkgs, ... }: {
_file = "mlabs-tooling.nix/module.nix:module";
# FIXME: contentAddressed = true;
inherit nonReinstallablePkgs; # Needed for a lot of different things
packages = {
cardano-crypto-class.components.library.pkgconfig = pkgs.lib.mkForce [ [ pkgs.libsodium-vrf pkgs.secp256k1 ] ];
cardano-crypto-praos.components.library.pkgconfig = pkgs.lib.mkForce [ [ pkgs.libsodium-vrf ] ];
};
};
in
{
_file = "mlabs-tooling.nix/module.nix";
config = {
cabalProjectLocal = ''
repository cardano-haskell-packages
url: https://input-output-hk.github.io/cardano-haskell-packages
secure: True
root-keys:
key-threshold: 0
allow-newer:
*:base,
*:containers,
*:directory,
*:time,
*:bytestring,
*:aeson,
*:protolude,
*:template-haskell,
*:ghc-prim,
*:ghc,
*:cryptonite,
*:formatting,
monoidal-containers:aeson,
size-based:template-haskell,
snap-server:attoparsec,
-- tasty-hedgehog:hedgehog,
*:hashable,
*:text
constraints:
text >= 2
, aeson >= 2
, dependent-sum >= 0.7
, protolude >= 0.3.2
, nothunks >= 0.1.3
package nothunks
flags: +vector +bytestring +text
'';
compiler-nix-name = lib.mkDefault inputs.self.lib.default-ghc;
modules = [ module brokenLibsModule ];
inputMap."https://input-output-hk.github.io/cardano-haskell-packages" = "${inputs.cardano-haskell-packages}";
shell = {
withHoogle = lib.mkOverride 999 false; # FIXME set to true
exactDeps = lib.mkOverride 999 true;
tools.haskell-language-server = { };
# We use the ones from Nixpkgs, since they are cached reliably.
# Eventually we will probably want to build these with haskell.nix.
nativeBuildInputs = [
pkgs'.cabal-install
(inputs.self.lib.mkFormatter inputs.nixpkgs.legacyPackages.${pkgs.system})
(inputs.self.lib.mkLinter inputs.nixpkgs.legacyPackages.${pkgs.system})
];
shellHook = ''
fp=$(git rev-parse --git-path hooks)/pre-commit
if test ! -e "$fp"
then
set -x
echo -e '#!/bin/sh\n\n,format check' > "$fp" \
&& chmod +x "$fp"
set +x
fi
'';
};
};
}