hnix/default.nix

130 lines
4.4 KiB
Nix
Raw Normal View History

2019-05-01 02:29:36 +02:00
{ compiler ? "ghc864"
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
2019-05-01 02:29:36 +02:00
, rev ? "ed1b59a98e7bd61dd7eac266569c294fb6b16300"
, sha256 ? "0b2wdbbaqdqccl7q9gskhfjk7xaqvjwcls4b6218anyc247gscnb"
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;
config.packageOverrides = pkgs: rec {
nix = pkgs.nixUnstable.overrideDerivation (attrs: {
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.";
configureFlags = attrs.configureFlags ++ [ "--disable-doc-gen" ];
buildInputs = attrs.buildInputs ++
[ pkgs.editline.dev
];
outputs = builtins.filter (s: s != "doc" && s != "man" ) attrs.outputs;
});
};
2018-05-15 21:16:02 +02:00
}
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;
2019-03-10 01:55:31 +01:00
mono-traversable = dontCheck super.mono-traversable;
these = doJailbreak super.these;
2019-05-01 02:29:36 +02:00
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 = "6c187da8f8166d595f36d6aaf419370283b3d1e9";
sha256 = "0nmnxprbwws3w1sh63p80qj09rkrgn9888g7iim5p8611qyhdgky";
# date = 2018-11-30T22:13:02+01:00;
}) {});
ghc-exactprint = dontCheck (self.callCabal2nix "ghc-exactprint"
(pkgs.fetchFromGitHub {
owner = "alanz";
repo = "ghc-exactprint";
rev = "281f65324fb1fcad8f5ceec06f5ea4c7d78cfb59";
sha256 = "1d6sjy5mw0jn09sgx7zn0w1gszn3mf6lzqsfv3li50fnvwv1gwzb";
# date = 2019-03-01T17:38:18+02: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
2019-03-17 21:59:53 +01:00
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;
}