2020-10-29 18:20:41 +03:00
|
|
|
{ lib, stdenv, darwin, haskell-nix, gmp, zlib, libffi, brass
|
2020-10-27 15:55:49 +03:00
|
|
|
, enableStatic ? stdenv.hostPlatform.isStatic }:
|
|
|
|
|
2020-11-04 17:34:03 +03:00
|
|
|
haskell-nix.stackProject {
|
2020-10-27 15:55:49 +03:00
|
|
|
compiler-nix-name = "ghc884";
|
|
|
|
index-state = "2020-09-24T00:00:00Z";
|
|
|
|
|
2020-11-04 17:34:03 +03:00
|
|
|
# This is incredibly difficult to get right, almost everything goes wrong.
|
|
|
|
# See: https://github.com/input-output-hk/haskell.nix/issues/496
|
|
|
|
src = haskell-nix.haskellLib.cleanSourceWith {
|
|
|
|
# Otherwise this depends on the name in the parent directory, which
|
|
|
|
# reduces caching, and is particularly bad on Hercules.
|
|
|
|
# See: https://github.com/hercules-ci/support/issues/40
|
|
|
|
name = "urbit-hs";
|
|
|
|
src = ../../../pkg/hs;
|
|
|
|
};
|
2020-10-27 15:55:49 +03:00
|
|
|
|
2020-11-04 17:34:03 +03:00
|
|
|
modules = [{
|
|
|
|
# This corresponds to the set of packages (boot libs) that ship with GHC.
|
|
|
|
# We declare them yere to ensure any dependency gets them from GHC itself
|
|
|
|
# rather than trying to re-install them into the package database.
|
|
|
|
nonReinstallablePkgs = [
|
|
|
|
"Cabal"
|
|
|
|
"Win32"
|
|
|
|
"array"
|
|
|
|
"base"
|
|
|
|
"binary"
|
|
|
|
"bytestring"
|
|
|
|
"containers"
|
|
|
|
"deepseq"
|
|
|
|
"directory"
|
|
|
|
"filepath"
|
|
|
|
"ghc"
|
|
|
|
"ghc-boot"
|
|
|
|
"ghc-boot-th"
|
|
|
|
"ghc-compact"
|
|
|
|
"ghc-heap"
|
|
|
|
"ghc-prim"
|
|
|
|
"ghci"
|
|
|
|
"ghcjs-prim"
|
|
|
|
"ghcjs-th"
|
|
|
|
"haskeline"
|
|
|
|
"hpc"
|
|
|
|
"integer-gmp"
|
|
|
|
"integer-simple"
|
|
|
|
"mtl"
|
|
|
|
"parsec"
|
|
|
|
"pretty"
|
|
|
|
"process"
|
|
|
|
"rts"
|
|
|
|
"stm"
|
|
|
|
"template-haskell"
|
|
|
|
"terminfo"
|
|
|
|
"text"
|
|
|
|
"time"
|
|
|
|
"transformers"
|
|
|
|
"unix"
|
|
|
|
"xhtml"
|
|
|
|
];
|
2020-10-29 18:20:41 +03:00
|
|
|
|
2020-11-06 11:47:11 +03:00
|
|
|
# Override various project-local flags and build configuration.
|
2020-11-04 17:34:03 +03:00
|
|
|
packages = {
|
2021-03-22 22:46:14 +03:00
|
|
|
urbit-king.patches = lib.optional stdenv.isDarwin [
|
|
|
|
../../pkgs/lmdb/darwin-fsync.patch
|
|
|
|
];
|
2020-11-06 11:47:11 +03:00
|
|
|
urbit-king.components.exes.urbit-king = {
|
|
|
|
enableStatic = enableStatic;
|
|
|
|
enableShared = !enableStatic;
|
2020-10-29 18:20:41 +03:00
|
|
|
|
2020-11-06 11:47:11 +03:00
|
|
|
configureFlags = lib.optionals enableStatic [
|
2020-11-04 17:34:03 +03:00
|
|
|
"--ghc-option=-optl=-L${gmp}/lib"
|
|
|
|
"--ghc-option=-optl=-L${libffi}/lib"
|
|
|
|
"--ghc-option=-optl=-L${zlib}/lib"
|
|
|
|
] ++ lib.optionals (enableStatic && stdenv.isDarwin)
|
2020-11-06 11:47:11 +03:00
|
|
|
[ "--ghc-option=-optl=-L${darwin.libiconv}/lib" ];
|
|
|
|
|
|
|
|
postInstall = lib.optionalString (enableStatic && stdenv.isDarwin) ''
|
|
|
|
find "$out/bin" -type f -exec \
|
|
|
|
install_name_tool -change \
|
|
|
|
${stdenv.cc.libc}/lib/libSystem.B.dylib \
|
|
|
|
/usr/lib/libSystem.B.dylib {} \;
|
|
|
|
'';
|
|
|
|
};
|
2020-10-27 15:55:49 +03:00
|
|
|
|
2020-11-04 17:34:03 +03:00
|
|
|
urbit-king.components.tests.urbit-king-tests.testFlags =
|
|
|
|
[ "--brass-pill=${brass.lfs}" ];
|
|
|
|
};
|
|
|
|
}];
|
2020-10-27 15:55:49 +03:00
|
|
|
}
|
2020-11-04 17:34:03 +03:00
|
|
|
|