-
Notifications
You must be signed in to change notification settings - Fork 6
/
make-marconi-project.nix
148 lines (129 loc) · 7.33 KB
/
make-marconi-project.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
{ inputs, cell }:
# Whether to set the `defer-plugin-errors` flag on those packages that need
# it. If set to true, we will also build the haddocks for those packages.
{ deferPluginErrors ? false
, enableHaskellProfiling ? false
}:
let
project = cell.library.pkgs.haskell-nix.cabalProject' ({ pkgs, config, lib, ... }: {
compiler-nix-name = cell.library.ghc-compiler-nix-name;
src = cell.library.pkgs.haskell-nix.haskellLib.cleanSourceWith {
src = inputs.self.outPath;
name = "marconi";
};
shell.withHoogle = false;
# source-repository-packages
sha256map = {
"https://github.com/input-output-hk/cardano-addresses"."b7273a5d3c21f1a003595ebf1e1f79c28cd72513" = "129r5kyiw10n2021bkdvnr270aiiwyq58h472d151ph0r7wpslgp";
"https://github.com/input-output-hk/cardano-config"."1646e9167fab36c0bff82317743b96efa2d3adaa" = "sha256-TNbpnR7llUgBN2WY7CryMxNVupBIUH01h1hRNHoxboY=";
"https://github.com/input-output-hk/cardano-ledger"."da3e9ae10cf9ef0b805a046c84745f06643583c2" = "sha256-3VUZKkLu1R43GUk9IwgsGQ55O0rnu8NrCkFX9gqA4ck=";
"https://github.com/input-output-hk/cardano-wallet"."18a931648550246695c790578d4a55ee2f10463e" = "0i40hp1mdbljjcj4pn3n6zahblkb2jmpm8l4wnb36bya1pzf66fx";
"https://github.com/sevanspowell/hw-aeson"."b5ef03a7d7443fcd6217ed88c335f0c411a05408" = "1dwx90wqavdl4d0npbzbxyh2pzi9zs1qz7nvsrb3n1cm2xbv4i5z";
"https://github.com/input-output-hk/plutus-apps"."9d90900d049f2333960fbc349cc816d2b163cda5" = "0cqm86z73k54rcnnplcwxl8v0l96pnmwlq4hgn9fjmlj01j2v3bv";
};
inputMap = {
"https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP;
};
# Configuration settings needed for cabal configure to work when cross compiling
# for windows. We can't use `modules` for these as `modules` are only applied
# after cabal has been configured.
cabalProjectLocal = lib.optionalString pkgs.stdenv.hostPlatform.isWindows ''
-- When cross compiling for windows we don't have a `ghc` package, so use
-- the `plutus-ghc-stub` package instead.
package plutus-tx-plugin
flags: +use-ghc-stub
-- Exlcude test that use `doctest`. They will not work for windows
-- cross compilation and `cabal` will not be able to make a plan.
package prettyprinter-configurable
tests: False
'';
modules =
let
inherit (config) src;
in
[
({ pkgs, ... }: lib.mkIf (pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform) {
packages = {
# Things that need plutus-tx-plugin
freer-extras.package.buildable = false;
cardano-node-emulator.package.buildable = false;
cardano-streaming.package.buildable = false;
marconi-chain-index.package.buildable = false;
marconi-core.package.buildable = false;
marconi-sidechain.package.buildable = false;
# These need R
plutus-core.components.benchmarks.cost-model-test.buildable = lib.mkForce false;
plutus-core.components.benchmarks.update-cost-model.buildable = lib.mkForce false;
};
})
({ pkgs, ... }:
let
# Add symlinks to the DLLs used by executable code to the `bin` directory
# of the components with we are going to run.
# We should try to find a way to automate this will in haskell.nix.
symlinkDlls = ''
ln -s ${pkgs.libsodium-vrf}/bin/libsodium-23.dll $out/bin/libsodium-23.dll
ln -s ${pkgs.buildPackages.gcc.cc}/x86_64-w64-mingw32/lib/libgcc_s_seh-1.dll $out/bin/libgcc_s_seh-1.dll
ln -s ${pkgs.buildPackages.gcc.cc}/x86_64-w64-mingw32/lib/libstdc++-6.dll $out/bin/libstdc++-6.dll
ln -s ${pkgs.windows.mcfgthreads}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll
'';
in
lib.mkIf (pkgs.stdenv.hostPlatform.isWindows) { }
)
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
packages = {
plutus-pab-executables.components.tests.plutus-pab-test-full-long-running.buildable = lib.mkForce false;
};
})
({ pkgs, config, ... }: {
packages = {
marconi-core.doHaddock = deferPluginErrors;
marconi-core.flags.defer-plugin-errors = deferPluginErrors;
marconi-chain-index.doHaddock = deferPluginErrors;
marconi-chain-index.flags.defer-plugin-errors = deferPluginErrors;
# The lines `export CARDANO_NODE=...` and `export CARDANO_CLI=...`
# is necessary to prevent the error
# `../dist-newstyle/cache/plan.json: openBinaryFile: does not exist (No such file or directory)`.
# See https://github.com/input-output-hk/cardano-node/issues/4194.
#
# The line 'export CARDANO_NODE_SRC=...' is used to specify the
# root folder used to fetch the `configuration.yaml` file (in
# marconi, it's currently in the
# `configuration/defaults/byron-mainnet` directory.
# Else, we'll get the error
# `/nix/store/ls0ky8x6zi3fkxrv7n4vs4x9czcqh1pb-marconi/marconi/test/configuration.yaml: openFile: does not exist (No such file or directory)`
marconi-chain-index.preCheck = "
export CARDANO_CLI=${config.hsPkgs.cardano-cli.components.exes.cardano-cli}/bin/cardano-cli${pkgs.stdenv.hostPlatform.extensions.executable}
export CARDANO_NODE=${config.hsPkgs.cardano-node.components.exes.cardano-node}/bin/cardano-node${pkgs.stdenv.hostPlatform.extensions.executable}
export CARDANO_NODE_SRC=${src}
";
marconi-sidechain.doHaddock = deferPluginErrors;
marconi-sidechain.flags.defer-plugin-errors = deferPluginErrors;
# FIXME: Haddock mysteriously gives a spurious missing-home-modules warning
plutus-tx-plugin.doHaddock = false;
# Relies on cabal-doctest, just turn it off in the Nix build
prettyprinter-configurable.components.tests.prettyprinter-configurable-doctest.buildable = lib.mkForce false;
# Broken due to warnings, unclear why the setting that fixes this for the build doesn't work here.
iohk-monitoring.doHaddock = false;
cardano-wallet.doHaddock = false;
# Werror everything. This is a pain, see https://github.com/input-output-hk/haskell.nix/issues/519
cardano-streaming.ghcOptions = [ "-Werror" ];
marconi-chain-index.ghcOptions = [ "-Werror" ];
marconi-core.ghcOptions = [ "-Werror" ];
marconi-sidechain.ghcOptions = [ "-Werror" ];
pab-blockfrost.ghcOptions = [ "-Werror" ];
# Honestly not sure why we need this, it has a mysterious unused dependency on "m"
# This will go away when we upgrade nixpkgs and things use ieee754 anyway.
ieee.components.library.libs = lib.mkForce [ ];
# See https://github.com/input-output-hk/iohk-nix/pull/488
cardano-crypto-praos.components.library.pkgconfig = lib.mkForce [ [ pkgs.libsodium-vrf ] ];
cardano-crypto-class.components.library.pkgconfig = lib.mkForce [ [ pkgs.libsodium-vrf pkgs.secp256k1 ] ];
};
})
] ++ lib.optional enableHaskellProfiling {
enableLibraryProfiling = true;
enableProfiling = true;
};
});
in
project