2020-05-31 16:06:34 +02:00
{ compiler ? " g h c 8 8 3 "
2018-05-15 21:16:02 +02:00
2020-05-31 22:07:14 +02:00
# doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file.
2018-04-12 05:21:52 +02:00
, doBenchmark ? false
2020-05-31 22:07:14 +02:00
# Generation and installation of a coverage report.
# See https://wiki.haskell.org/Haskell_program_coverage
2020-05-31 16:06:34 +02:00
, doCoverage ? false
2020-05-31 22:07:14 +02:00
# Generation and installation of haddock API documentation
2020-05-31 16:06:34 +02:00
, doHaddock ? false
2020-05-31 22:07:14 +02:00
# Nix dependency checking, compilation and execution of test suites listed in the package description file.
2020-05-31 16:06:34 +02:00
, doCheck ? true
2020-05-31 16:04:15 +02:00
, enableLibraryProfiling ? false
, enableExecutableProfiling ? false
2018-04-24 01:39:37 +02:00
, doTracing ? false
2020-05-31 22:07:14 +02:00
# Enables GHC optimizations for production use, without optimizations compilation is way faster
, doOptimize ? false
2018-04-29 03:21:24 +02:00
, doStrict ? false
2020-05-31 22:07:14 +02:00
# Escape the version bounds from the cabal file. You may want to avoid this function.
2020-05-31 21:48:41 +02:00
, doJailbreak ? false
, enableSharedExecutables ? true
, enableSharedLibraries ? true
, enableStaticLibraries ? false
, enableDeadCodeElimination ? true
, doHyperlinkSource ? false
, doStrip ? false
, justStaticExecutables ? false
2020-05-31 22:07:14 +02:00
# Don't fail at configure time if there are multiple versions of the same package in the (recursive) dependencies of the package being built. Will delay failures, if any, to compile time.
2020-05-31 21:48:41 +02:00
, allowInconsistentDependencies ? false
2018-05-15 21:16:02 +02:00
2019-05-01 02:29:36 +02:00
, withHoogle ? true
2019-02-17 00:39:03 +01:00
2020-06-01 17:47:42 +02:00
, rev ? " n i x p k g s - u n s t a b l e "
2018-11-22 18:52:52 +01:00
2020-01-09 03:34:08 +01:00
, pkgs ?
2018-05-15 21:16:02 +02:00
if builtins . compareVersions builtins . nixVersion " 2 . 0 " < 0
then abort " h n i x r e q u i r e s a t l e a s t n i x 2 . 0 "
2020-06-01 17:46:04 +02:00
else import ( builtins . fetchTarball " h t t p s : / / g i t h u b . c o m / N i x O S / n i x p k g s / a r c h i v e / ${ rev } . t a r . g z " ) {
2020-01-09 03:34:08 +01:00
config . allowBroken = true ;
# config.packageOverrides = pkgs: rec {
# nix = pkgs.nixStable.overrideDerivation (attrs: with pkgs; rec {
# src = if builtins.pathExists ./data/nix/.version
# then data/nix
# else throw "data/nix doesn't seem to contain the nix source. You may want to run git submodule update --init.";
# enableParallelBuilding = true;
# configureFlags =
# [ "--disable-doc-gen"
# "--enable-gc"
# ];
# buildInputs =
# [ bison
# flex
# autoconf-archive
# autoreconfHook
# curl
# bzip2 xz brotli editline
# openssl pkgconfig sqlite boehmgc
# boost
# git
# mercurial
# ]
# ++ lib.optionals stdenv.isLinux [libseccomp utillinuxMinimal]
# ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
# ++ lib.optional (stdenv.isLinux || stdenv.isDarwin)
# (aws-sdk-cpp.override {
# apis = ["s3" "transfer"];
# customMemoryManagement = false;
# });
# outputs = builtins.filter (s: s != "doc" && s != "man" ) attrs.outputs;
# });
# };
}
2018-11-22 18:52:52 +01:00
2018-11-22 20:21:06 +01:00
, mkDerivation ? null
2018-04-12 05:21:52 +02:00
} :
2018-04-07 01:23:24 +02:00
2019-03-10 01:55:31 +01:00
let
2020-05-23 20:11:23 +02:00
# 2020-05-23: NOTE: Currently HNix-store needs no overlay
# hnix-store-src = pkgs.fetchFromGitHub {
# owner = "haskell-nix";
# repo = "hnix-store";
# rev = "0.2.0.0";
# sha256 = "1qf5rn43d46vgqqgmwqdkjh78rfg6bcp4kypq3z7mx46sdpzvb78";
# };
2019-03-10 01:55:31 +01:00
overlay = pkgs . lib . foldr pkgs . lib . composeExtensions ( _ : _ : { } ) [
2020-05-23 20:11:23 +02:00
# (import "${hnix-store-src}/overlay.nix")
2020-05-23 20:01:26 +02:00
( self : super : with pkgs . haskell . lib ;
pkgs . lib . optionalAttrs withHoogle {
2019-03-10 01:55:31 +01:00
ghc = super . ghc // { withPackages = super . ghc . withHoogle ; } ;
ghcWithPackages = self . ghc . withPackages ;
} )
] ;
overrideHaskellPackages = orig : {
buildHaskellPackages =
orig . buildHaskellPackages . override overrideHaskellPackages ;
overrides = if orig ? overrides
then pkgs . lib . composeExtensions orig . overrides overlay
else overlay ;
} ;
haskellPackages = pkgs . haskell . packages . ${ compiler } . override
overrideHaskellPackages ;
2018-07-25 20:53:48 +02:00
2019-03-23 05:56:45 +01:00
in haskellPackages . developPackage {
2018-11-24 21:31:36 +01:00
name = " h n i x " ;
2018-04-17 00:10:47 +02:00
root = ./. ;
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
] ;
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 ;
2020-05-31 16:06:34 +02:00
inherit doCoverage ;
inherit doHaddock ;
inherit doCheck ;
2020-05-31 16:04:15 +02:00
inherit enableLibraryProfiling ;
inherit enableExecutableProfiling ;
2018-04-24 01:39:37 +02:00
2018-04-29 03:21:24 +02:00
configureFlags =
2018-11-22 20:23:54 +01:00
pkgs . stdenv . lib . optional doTracing " - - f l a g s = t r a c i n g "
++ pkgs . stdenv . lib . optional doOptimize " - - f l a g s = o p t i m i z e "
++ pkgs . stdenv . lib . optional doStrict " - - g h c - o p t i o n s = - W e r r o r " ;
2018-11-18 00:48:37 +01:00
2019-03-09 23:40:38 +01:00
passthru = {
nixpkgs = pkgs ;
inherit haskellPackages ;
} ;
2018-04-17 00:10:47 +02:00
} ) ;
2018-05-16 09:11:14 +02:00
2019-03-09 23:40:38 +01:00
returnShellEnv = false ;
2019-03-23 05:56:45 +01:00
}