summaryrefslogtreecommitdiff
path: root/Biz/Bild/Rules.nix
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-12-29 22:29:57 -0500
committerBen Sima <ben@bsima.me>2020-12-29 22:29:57 -0500
commit36eac84f40aa938fd9327ddf4f983736ff550bcf (patch)
tree75da57d82a42e5039227ac8605b004e8e251a6c4 /Biz/Bild/Rules.nix
parentb11e926cf60672c17b462ad142014946063f4136 (diff)
Deploy hoogle to Biz.Dev
I had to refactor Biz/Bild/Rules.nix. I also had to checkin my patched hoogle.nix file, but I also upstreamed the patch to nixpkgs-dev so it shouldn't stick around for too long.
Diffstat (limited to 'Biz/Bild/Rules.nix')
-rw-r--r--Biz/Bild/Rules.nix31
1 files changed, 13 insertions, 18 deletions
diff --git a/Biz/Bild/Rules.nix b/Biz/Bild/Rules.nix
index f5f016f..9a7ad77 100644
--- a/Biz/Bild/Rules.nix
+++ b/Biz/Bild/Rules.nix
@@ -13,14 +13,14 @@ let
lines = s: lib.strings.splitString "\n" s;
removeNull = ls: builtins.filter (x: x != null) ls;
- depsToPackageSet = packageSet: deps:
+ selectAttrs = deps: packageSet:
lib.attrsets.attrVals deps packageSet;
# returns true if a is a subset of b, where a and b are attrsets
subset = a: b: builtins.all
(x: builtins.elem x b) a;
- haskellDeps = import ./Deps/Haskell.nix;
+ haskellDeps = hpkgs: import ./Deps/Haskell.nix hpkgs;
# gather data needed for compiling by analyzing the main module
analyze = main: rec {
@@ -45,25 +45,20 @@ let
(lines content)));
};
- mkGhc = compiler: (deps: compiler (hp:
- if (subset deps haskellDeps)
- then depsToPackageSet hp deps
- else throw ''
- missing from nix/haskell-deps.nix:
- ${toString (lib.lists.subtractLists haskellDeps deps)}
- ''));
-
- ghc_ = mkGhc pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle;
- ghcjs_ = mkGhc pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages;
-in {
+ mkGhcPackageSet = pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle;
+ mkGhcjsPackageSet = pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages;
+
+in rec {
+ ghcPackageSetFull = mkGhcPackageSet haskellDeps;
+
ghc = main:
let
data = analyze main;
- ghc = ghc_ data.deps;
+ ghc = mkGhcPackageSet (hp: selectAttrs data.deps hp);
in stdenv.mkDerivation {
name = data.module;
src = ../../.;
- nativeBuildInputs = [ ghc ] ++ depsToPackageSet nixpkgs data.sysdeps;
+ nativeBuildInputs = [ ghc ] ++ selectAttrs data.sysdeps nixpkgs;
strictDeps = true;
buildPhase = ''
mkdir -p $out/bin
@@ -82,7 +77,7 @@ in {
ghcjs = main:
let
data = analyze main;
- ghcjs = ghcjs_ data.deps;
+ ghcjs = mkGhcjsPackageSet (hp: selectAttrs data.dep hp);
in stdenv.mkDerivation {
name = data.module;
src = ../../.;
@@ -108,9 +103,9 @@ in {
name = "bizdev";
buildInputs = [
# haskell deps
- (ghc_ haskellDeps)
+ (mkGhcPackageSet haskellDeps)
# ghcjs doesn't need everything, and many things fail to build
- (ghcjs_ [
+ (mkGhcjsPackageSet [
"aeson"
"clay"
"containers"