hnix/default.nix

74 lines
1.9 KiB
Nix

{ compiler ? "ghc863"
, doBenchmark ? false
, doTracing ? false
, doOptimize ? false # enables GHC optimizations for production use
, doProfiling ? false # enables profiling support in GHC
, doStrict ? false
, withHoogle ? false
, rev ? "120eab94e0981758a1c928ff81229cd802053158"
, sha256 ? "0qk6k8gxx5xlkyg05dljywj5wx5fvrc3dzp4v2h6ab83b7zwg813"
, pkgs ?
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;
}
, mkDerivation ? null
}:
let haskellPackages = pkgs.haskell.packages.${compiler};
drv = haskellPackages.developPackage {
name = "hnix";
root = ./.;
overrides = with pkgs.haskell.lib; self: super: {
mono-traversable = dontCheck super.mono-traversable;
these = doJailbreak super.these;
} //
(if withHoogle then {
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
ghcWithPackages = self.ghc.withPackages;
} else {});
source-overrides = {};
modifier = drv: pkgs.haskell.lib.overrideCabal drv (attrs: {
buildTools = (attrs.buildTools or []) ++ [
haskellPackages.cabal-install
];
enableLibraryProfiling = doProfiling;
enableExecutableProfiling = doProfiling;
testHaskellDepends = attrs.testHaskellDepends ++ [
pkgs.nix
haskellPackages.criterion
];
inherit doBenchmark;
configureFlags =
pkgs.stdenv.lib.optional doTracing "--flags=tracing"
++ pkgs.stdenv.lib.optional doOptimize "--flags=optimize"
++ pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror";
passthru = {
nixpkgs = pkgs;
inherit haskellPackages;
};
});
returnShellEnv = false;
};
in drv