diff options
author | Ben Sima <ben@bsima.me> | 2021-12-14 08:14:12 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-12-14 08:17:46 -0500 |
commit | 58d00038a26efad6f103f020410d11f9c114899d (patch) | |
tree | ad82924da4bd5c1bcf8c492a8a427a0cb4bed757 /Biz/Bild.nix | |
parent | ddd8ca76de7fb32f2253986e425f161c11472cf0 (diff) |
Add custom package db to ghcPkgFindModule
This means my call to ghc-pkg will look at the full package set from Hoogle.
Diffstat (limited to 'Biz/Bild.nix')
-rw-r--r-- | Biz/Bild.nix | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 8d57d54..6279d2f 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -22,6 +22,12 @@ let #mkGhcjsPackageSet = nixpkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; ghcPackageSetFull = mkGhcPackageSet haskellDeps; + ghcPackageSetBild = mkGhcPackageSet (hpkgs: with hpkgs; [ + aeson async base bytestring conduit conduit-extra containers directory + docopt filepath process protolude rainbow regex-applicative split tasty + tasty-hunit tasty-quickcheck text + wai # can remove when removed from Biz.Log + ]); in rec { inherit (nixpkgs) lib stdenv pkgs sources; @@ -30,11 +36,14 @@ in rec { bild = stdenv.mkDerivation { name = "bild"; src = ../.; - nativeBuildInputs = [ ghcPackageSetFull ]; + nativeBuildInputs = [ ghcPackageSetBild ]; buildInputs = [ nixpkgs.makeWrapper ]; strictDeps = true; buildPhase = '' - mkdir -p $out/bin + mkdir -p $out/bin $out/lib/ghc-${ghcPackageSetFull.version} + cp -r \ + ${ghcPackageSetFull}/lib/ghc-${ghcPackageSetFull.version}/package.conf.d \ + $out/lib/ghc-${ghcPackageSetFull.version} ghc \ -Werror \ -i. \ @@ -43,7 +52,10 @@ in rec { -o $out/bin/bild ''; installPhase = '' - wrapProgram $out/bin/bild --prefix PATH : ${lib.makeBinPath [ ghcPackageSetFull ]} + wrapProgram $out/bin/bild \ + --prefix PATH : ${lib.makeBinPath [ ghcPackageSetBild ]} \ + --set GHC_PACKAGE_PATH \ + $out/lib/ghc-${ghcPackageSetFull.version}/package.conf.d ''; }; @@ -59,11 +71,9 @@ in rec { # working directory: MAIN = "." + lib.strings.removePrefix (toString src) (toString main); buildPhase = '' - set -eux mkdir $out - : analyzing with bild - ${bild}/bin/bild --json "$MAIN" 1> $out/analysis.json 2> $out/stderr - set +eux + ${bild}/bin/bild --json "$MAIN" 1> $out/analysis.json \ + 2> >(tee -a $out/stderr >&2) ''; installPhase = "exit 0"; }; |