hnix/default.nix

72 lines
1.9 KiB
Nix
Raw Normal View History

2019-02-17 00:39:03 +01:00
{ compiler ? "ghc863"
2018-05-15 21:16:02 +02:00
, doBenchmark ? false
, doTracing ? false
2018-11-22 20:21:06 +01:00
, doOptimize ? false # enables GHC optimizations for production use
, doProfiling ? false # enables profiling support in GHC
2018-04-29 03:21:24 +02:00
, doStrict ? false
2018-05-15 21:16:02 +02:00
2019-02-17 00:39:03 +01:00
, withHoogle ? false
, rev ? "120eab94e0981758a1c928ff81229cd802053158"
, sha256 ? "0qk6k8gxx5xlkyg05dljywj5wx5fvrc3dzp4v2h6ab83b7zwg813"
2018-11-22 20:21:06 +01: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
2018-11-22 20:21:06 +01:00
, mkDerivation ? null
}:
2018-04-07 01:23:24 +02:00
let haskellPackages = pkgs.haskell.packages.${compiler};
2018-07-25 20:53:48 +02:00
drv = haskellPackages.developPackage {
name = "hnix";
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;
2019-02-17 02:26:36 +01:00
these = doJailbreak super.these;
2019-02-17 00:39:03 +01:00
} //
(if withHoogle then {
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
ghcWithPackages = self.ghc.withPackages;
} else {});
2018-04-17 00:10:47 +02:00
2018-11-22 20:21:06 +01:00
source-overrides = {};
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 []) ++ [
2019-02-17 00:39:03 +01:00
haskellPackages.cabal-install
2018-07-26 02:56:21 +02:00
];
enableLibraryProfiling = doProfiling;
enableExecutableProfiling = doProfiling;
2019-02-17 00:39:03 +01:00
testHaskellDepends = attrs.testHaskellDepends ++ [
pkgs.nix
haskellPackages.criterion
];
2018-04-17 00:10:47 +02:00
inherit doBenchmark;
2018-04-29 03:21:24 +02:00
configureFlags =
2018-11-22 20:23:54 +01:00
pkgs.stdenv.lib.optional doTracing "--flags=tracing"
++ pkgs.stdenv.lib.optional doOptimize "--flags=optimize"
++ pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror";
2019-02-17 00:39:03 +01:00
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