hnix/default.nix

157 lines
5.2 KiB
Nix
Raw Normal View History

{ compiler ? "ghc865"
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-05-01 02:29:36 +02:00
, withHoogle ? true
2019-02-17 00:39:03 +01:00
, rev ? "7e8454fb856573967a70f61116e15f879f2e3f6a"
, 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.fetchGit {
url = "https://github.com/NixOS/nixpkgs/";
inherit rev; }) {
config.allowUnfree = true;
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 20:21:06 +01:00
, mkDerivation ? null
}:
2018-04-07 01:23:24 +02:00
2019-03-10 01:55:31 +01:00
let
hnix-store-src = pkgs.fetchFromGitHub {
owner = "haskell-nix";
repo = "hnix-store";
rev = "0.1.0.0";
sha256 = "1z48msfkiys432rkd00fgimjgspp98dci11kgg3v8ddf4mk1s8g0";
2019-03-10 01:55:31 +01:00
};
overlay = pkgs.lib.foldr pkgs.lib.composeExtensions (_: _: {}) [
(import "${hnix-store-src}/overlay.nix")
(self: super: with pkgs.haskell.lib; {
# Type error in the tests under ghc844 package set
Diff = dontCheck super.Diff;
# These packages only depend on contravariant when ghc >= 8.6.3
# Without normalizing the dependencies, our build fails with
# aeson and base-compat-batteries unable to find `contravariant`
aeson = addBuildDepend super.aeson self.contravariant;
base-compat-batteries = addBuildDepend super.base-compat-batteries self.contravariant;
mono-traversable = dontCheck super.mono-traversable;
regex-tdfa-text = doJailbreak super.regex-tdfa-text;
these = doJailbreak super.these;
semialign-indexed = doJailbreak super.semialign-indexed;
multistate = doJailbreak (overrideCabal super.multistate (attrs: { broken = false; }));
butcher = doJailbreak (overrideCabal super.butcher (attrs: { broken = false; }));
2019-03-17 21:59:53 +01:00
brittany = doJailbreak (self.callCabal2nix "brittany"
(pkgs.fetchFromGitHub {
owner = "lspitzner";
repo = "brittany";
rev = "af227a797d588eda936280dc1c3b0b376735335e";
sha256 = "0l1nk4dgmlv8vl1d993vnyw3da0kzg4gq8c2zd8sd224f2rz6f35";
# date = 2019-12-20T01:20:07+01:00;
2019-03-17 21:59:53 +01:00
}) {});
ghc-exactprint = dontCheck (self.callCabal2nix "ghc-exactprint"
(pkgs.fetchFromGitHub {
owner = "alanz";
repo = "ghc-exactprint";
rev = "91f54d7a7a1d8d2131c5e83d13dee6c9e8b57831";
sha256 = "15yf0ckcb6f706p39w448vgj0nrkd0rk71lvb1nd0ak46y0aqnhb";
# date = 2019-08-28T20:44:28+02:00;
2019-03-17 21:59:53 +01:00
}) {});
2019-03-10 01:55:31 +01:00
} // pkgs.lib.optionalAttrs withHoogle {
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
in haskellPackages.developPackage {
name = "hnix";
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
# haskellPackages.brittany
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";
passthru = {
nixpkgs = pkgs;
inherit haskellPackages;
};
2018-04-17 00:10:47 +02:00
});
2018-05-16 09:11:14 +02:00
returnShellEnv = false;
}