hnix/default.nix

101 lines
2.9 KiB
Nix
Raw Normal View History

{ compiler ? "ghc844"
2018-05-15 21:16:02 +02:00
, doBenchmark ? false
, doTracing ? false
# enables GHC optimizations for production use
, doOptimize ? false
# enables profiling support in GHC
, doProfiling ? false
2018-04-29 03:21:24 +02:00
, doStrict ? false
2018-05-15 21:16:02 +02:00
, rev ? "b37872d4268164614e3ecef6e1f730d48cf5a90f"
, sha256 ? "05km33sz4srf05vvmkidz3k59phm5a3k9wpj1jc6ly9yqws0dbn4"
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-25 20:53:48 +02:00
let
2018-04-07 01:23:24 +02:00
2018-07-25 20:53:48 +02:00
haskellPackages = pkgs.haskell.packages.${compiler};
drv = haskellPackages.developPackage {
2018-04-17 00:10:47 +02:00
root = ./.;
2018-07-17 22:31:29 +02:00
overrides = with pkgs.haskell.lib; self: super: {
2018-08-04 23:23:03 +02:00
mono-traversable = dontCheck super.mono-traversable;
2018-11-17 05:14:23 +01:00
megaparsec = self.callCabal2nix "megaparsec" (pkgs.fetchFromGitHub {
owner = "mrkkrp";
repo = "megaparsec";
rev = "9fff501f7794c01e2cf4a7a492f1cfef67fab19a";
sha256 = "0a9g6gpc8m9qrvldwn4chs0yqnr4dps93achg1df72lxknrpp0iy";
}) {};
2018-07-17 22:31:29 +02:00
}
//
(pkgs.lib.optionalAttrs (compiler == "ghc802") {
2018-07-17 22:31:29 +02:00
concurrent-output = doJailbreak super.concurrent-output;
})
2018-07-17 22:31:29 +02:00
//
(pkgs.lib.optionalAttrs (compiler != "ghcjs") {
2018-07-17 22:31:29 +02:00
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 = pkgs.lib.optionalAttrs (compiler == "ghc802") {
lens-family-core = "1.2.1";
lens-family = "1.2.1";
};
2018-04-17 00:10:47 +02:00
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
2018-07-26 02:56:21 +02:00
buildTools = (attrs.buildTools or []) ++ [
pkgs.haskell.packages.${compiler}.cabal-install
];
enableLibraryProfiling = doProfiling;
enableExecutableProfiling = doProfiling;
2018-04-17 00:10:47 +02:00
testHaskellDepends = attrs.testHaskellDepends ++
[ pkgs.nix
pkgs.haskell.packages.ghc844.criterion
2018-07-17 22:31:29 +02:00
];
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 doOptimize "--flags=optimize"
2018-05-30 20:08:15 +02:00
++ pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror";
passthru = {
nixpkgs = pkgs;
};
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-07-25 20:53:48 +02:00
};
2018-08-01 15:47:30 +02:00
in drv