This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
/
haskell.nix
88 lines (80 loc) · 3.51 KB
/
haskell.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
############################################################################
# Builds Haskell packages with Haskell.nix
############################################################################
{ lib
, stdenv
, haskell-nix
, buildPackages
, config ? {}
# GHC attribute name
, compiler ? config.haskellNix.compiler or "ghc865"
# Enable profiling
, profiling ? config.haskellNix.profiling or false
}:
let
src = haskell-nix.haskellLib.cleanGit {
name = "cardano-shell";
src = ../.;
};
# This creates the Haskell package set.
# https://input-output-hk.github.io/haskell.nix/user-guide/projects/
pkgSet = haskell-nix.cabalProject (lib.optionalAttrs stdenv.hostPlatform.isWindows {
# FIXME: without this deprecated attribute, db-converter fails to compile directory with:
# Encountered missing dependencies: unix >=2.5.1 && <2.9
ghc = buildPackages.haskell-nix.compiler.${compiler};
} // {
inherit src;
modules = [
{ compiler.nix-name = compiler; }
# Allow reinstallation of Win32
{ nonReinstallablePkgs =
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
# ghcjs custom packages
"ghcjs-prim" "ghcjs-th"
"ghc-boot"
"ghc" "array" "binary" "bytestring" "containers"
"filepath" "ghc-boot" "ghc-compact" "ghc-prim"
# "ghci" "haskeline"
"hpc"
"mtl" "parsec" "text" "transformers"
"xhtml"
# "stm" "terminfo"
];
}
{
# These tests need files from the source tree.
packages.cardano-launcher.components.tests.cardano-launcher-test.keepSource = true;
# Packages we wish to ignore version bounds of.
# This is similar to jailbreakCabal, however it
# does not require any messing with cabal files.
packages.katip.doExactConfig = true;
# split data output for ekg to reduce closure size
packages.ekg.components.library.enableSeparateDataOutput = true;
}
(lib.optionalAttrs profiling {
enableLibraryProfiling = true;
packages.cardano-launcher.components.exes.cardano-launcher.enableExecutableProfiling = true;
profilingDetail = "default";
})
(lib.optionalAttrs stdenv.hostPlatform.isWindows {
# Make sure we use a buildPackages version of happy
packages.pretty-show.components.library.build-tools = [ buildPackages.haskell-nix.haskellPackages.happy ];
# Remove hsc2hs build-tool dependencies (suitable version will be available as part of the ghc derivation)
packages.Win32.components.library.build-tools = lib.mkForce [];
packages.terminal-size.components.library.build-tools = lib.mkForce [];
packages.network.components.library.build-tools = lib.mkForce [];
# Disable cabal-doctest tests by turning off custom setups
packages.comonad.package.buildType = lib.mkForce "Simple";
packages.distributive.package.buildType = lib.mkForce "Simple";
packages.lens.package.buildType = lib.mkForce "Simple";
packages.nonempty-vector.package.buildType = lib.mkForce "Simple";
packages.semigroupoids.package.buildType = lib.mkForce "Simple";
})
];
# TODO add flags to packages (like cs-ledger) so we can turn off tests that will
# not build for windows on a per package bases (rather than using --disable-tests).
configureArgs = lib.optionalString stdenv.hostPlatform.isWindows "--disable-tests";
});
in
pkgSet