on iko/ghcjs-patch-master help sign in
Move weakCallPackage to haskellLib
commitb05d34a60fce6e33aa4923e39b7a1f7b4e81ca9a authorWill Fancher <elvishjerricco@gmail.com> dateMon 29 Oct 2018, 02:42 (8 years ago) parentd4490f3
3 files changed+18−19
builder/default.nix+2−2 lib/default.nix+16 new-package-set.nix−17
builder/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ pkgs, stdenv, lib, haskellLib, ghc, fetchurl, writeText, runCommand, pkgconfig, weakCallPackage }:
1+{ pkgs, stdenv, lib, haskellLib, ghc, fetchurl, writeText, runCommand, pkgconfig }:
22
33{ flags ? {}
44, package ? {}
@@ -53,7 +53,7 @@ let
5353 '';
5454 };
5555
56− comp-builder = weakCallPackage pkgs ./comp-builder.nix { inherit ghc haskellLib; };
56+ comp-builder = haskellLib.weakCallPackage pkgs ./comp-builder.nix { inherit ghc haskellLib; };
5757
5858 buildComp = componentId: component: comp-builder {
5959 inherit componentId package name src flags setup cabalFile;
lib/default.nix+16
@@ -151,4 +151,20 @@ with haskellLib;
151151 // lib.mapAttrs (_: new-builder) configs;
152152 };
153153
154+ # Avoid pkgs.callPackage for now. It does a lot of nonsense with OOP
155+ # style programming that we should avoid until we know we want it.
156+
157+ # weakCallPackage: call a function or (importable expression)
158+ # with scope + args.
159+ #
160+ # weakCallPackage scope f args
161+ # will call f (scope // args)
162+ #
163+ # weakCallpackage scope ./path args
164+ # will call the expression at ./path with (scope // args)
165+ #
166+ weakCallPackage = scope: f: args:
167+ let f' = if lib.isFunction f then f else import f;
168+ args' = scope // args;
169+ in f' (builtins.intersectAttrs (builtins.functionArgs f') args');
154170}
new-package-set.nix−17
@@ -14,23 +14,6 @@
1414 # complier as needed.
1515 ghc = pkgs.haskell.compiler.${plan.compiler.nix-name};
1616
17− # Avoid pkgs.callPackage for now. It does a lot of nonsense with OOP
18− # style programming that we should avoid until we know we want it.
19−
20− # weakCallPackage: call a function or (importable expression)
21− # with scope + args.
22− #
23− # weakCallPackage scope f args
24− # will call f (scope // args)
25− #
26− # weakCallpackage scope ./path args
27− # will call the expression at ./path with (scope // args)
28− #
29− weakCallPackage = scope: f: args:
30− let f' = if lib.isFunction f then f else import f;
31− args' = scope // args;
32− in f' (builtins.intersectAttrs (builtins.functionArgs f') args');
33−
3417 # this is *not* the hasekllLib from nixpkgs; it is rather our own
3518 # library from haskell.nix
3619 haskellLib = import ./lib { inherit lib haskellLib; };