hnix/default.nix

89 lines
2.6 KiB
Nix
Raw Normal View History

2018-05-16 00:42:05 +02:00
{ compiler ? "ghc822"
2018-05-15 21:16:02 +02:00
, doBenchmark ? false
, doTracing ? false
2018-04-29 03:21:24 +02:00
, doStrict ? false
2018-05-15 21:16:02 +02:00
, rev ? "49bdae006e66e70ad3245a463edc01b5749250d3"
, sha256 ? "1ijsifmap47nfzg0spny94lmj66y3x3x8i6vs471bnjamka3dx8p"
2018-05-21 08:41:16 +02:00
, pkgs ?
2018-05-15 21:16:02 +02:00
if builtins.compareVersions builtins.nixVersion "2.0" < 0
then abort "hnix requires at least nix 2.0"
else import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
inherit sha256; }) {
config.allowUnfree = true;
config.allowBroken = false;
}
2018-05-21 08:41:16 +02:00
, returnShellEnv ? pkgs.lib.inNixShell
, mkDerivation ? null
}:
2018-04-07 01:23:24 +02:00
2018-07-17 22:31:29 +02:00
let haskellPackages = pkgs.haskell.packages.${compiler};
2018-04-07 01:23:24 +02:00
2018-04-17 00:10:47 +02:00
in haskellPackages.developPackage {
root = ./.;
2018-07-17 22:31:29 +02:00
overrides = with pkgs.haskell.lib; self: super: {
megaparsec = super.megaparsec_6_5_0;
}
//
(if compiler == "ghc802"
then {
concurrent-output = doJailbreak super.concurrent-output;
}
else {})
//
(if compiler == "ghcjs" then {} else
{
cryptohash-md5 = doJailbreak super.cryptohash-md5;
cryptohash-sha1 = doJailbreak super.cryptohash-sha1;
cryptohash-sha256 = doJailbreak super.cryptohash-sha256;
cryptohash-sha512 = doJailbreak super.cryptohash-sha512;
serialise = dontCheck super.serialise;
ghc-datasize =
overrideCabal super.ghc-datasize (attrs: {
enableLibraryProfiling = false;
enableExecutableProfiling = false;
});
ghc-heap-view =
overrideCabal super.ghc-heap-view (attrs: {
enableLibraryProfiling = false;
enableExecutableProfiling = false;
});
});
source-overrides =
if compiler == "ghc802"
then {
lens-family-core = "1.2.1";
lens-family = "1.2.1";
2018-07-17 22:31:29 +02:00
hspec-discover = "2.5.5";
}
else {};
2018-04-17 00:10:47 +02:00
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
testHaskellDepends = attrs.testHaskellDepends ++
[ pkgs.nix
# Use the same version of hpack no matter what the compiler version
# is, so that we know exactly what the contents of the generated
# .cabal file will be. Otherwise, Travis may error out claiming that
# the cabal file needs to be updated because the result is different
# that the version we committed to Git.
2018-07-17 22:31:29 +02:00
pkgs.haskell.packages.ghc822.hpack
pkgs.haskell.packages.ghc822.criterion
];
2018-04-17 00:10:47 +02:00
inherit doBenchmark;
2018-04-29 03:21:24 +02:00
configureFlags =
2018-05-30 20:08:15 +02:00
pkgs.stdenv.lib.optional doTracing "--flags=tracing"
++ pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror";
2018-04-17 00:10:47 +02:00
});
2018-05-16 09:11:14 +02:00
2018-05-21 08:41:16 +02:00
inherit returnShellEnv;
2018-04-17 00:10:47 +02:00
}