diff options
author | aszlig <aszlig@redmoonstudios.org> | 2017-04-23 23:05:42 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2017-04-23 23:08:17 +0200 |
commit | d84890a208614ba305e66ba96f81f7e2fd378c27 (patch) | |
tree | d3ada36d0ec0c89f4e8b446f0502e84902d3cc26 /pkgs/default.nix | |
parent | 04b7c6074816ed6c3ef63c48668dc23f1e75037b (diff) |
pkgs: Move callPackageScope into pkgs/lib
Now the pkgs/default.nix is a lot more readable because it has only the top-level derivations and the callPackageScope invocations for the corresponding sub-scopes. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/default.nix')
-rw-r--r-- | pkgs/default.nix | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix index 8303e0a5..ce39a5bc 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,34 +1,14 @@ { pkgs ? import (import ../nixpkgs-path.nix) {} }: let - inherit (pkgs.lib) callPackageWith isFunction; + inherit (pkgs.lib) callPackageWith; callPackage = callPackageWith (pkgs // self.vuizvui); callPackage_i686 = callPackageWith (pkgs.pkgsi686Linux // self.vuizvui); - callPackageScope = fn: let - f = if isFunction fn then fn else import fn; - - toplevel = pkgs // self.vuizvui; - toplevel_i686 = pkgs.pkgsi686Linux // self.vuizvui; - - autoArgs = toplevel // { - callPackage = callPackageWith (toplevel // super); - callPackage_i686 = callPackageWith (toplevel_i686 // super); - }; - args = builtins.intersectAttrs (builtins.functionArgs f) autoArgs; - - mkOverridable = overrideFun: origArgs: let - superSet = overrideFun origArgs; - overrideWith = newArgs: let - overridden = if isFunction newArgs then newArgs origArgs else newArgs; - in origArgs // overridden; - in superSet // { - override = newArgs: mkOverridable overrideFun (overrideWith newArgs); - }; - - super = mkOverridable f args; - - in pkgs.recurseIntoAttrs super; + callPackageScope = import ./lib/call-package-scope.nix { + pkgs = pkgs // self.vuizvui; + pkgsi686Linux = pkgs.pkgsi686Linux // self.vuizvui; + }; self.vuizvui = pkgs.recurseIntoAttrs { mkChannel = callPackage ./build-support/channel.nix { }; |