summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2018-07-02 13:25:24 -0400
committerGitHub <noreply@github.com>2018-07-02 13:25:24 -0400
commitccfe1b5713ffe10cd2242766a90074b423f48fa5 (patch)
tree50fcec19d2f08ae92049a5be3e9cba1c9ffaaab4
parenta444ed38702c706dd5c38d5412503f05eb021ae0 (diff)
parent18af089de75270523a127a76b62da32165f1f548 (diff)
downloadnixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar.gz
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar.bz2
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar.lz
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar.xz
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.tar.zst
nixpkgs-ccfe1b5713ffe10cd2242766a90074b423f48fa5.zip
Merge pull request #42874 from obsidiansystems/crossPkgs
Add pkgsCross & pkgsLocal
-rw-r--r--pkgs/top-level/all-packages.nix29
-rw-r--r--pkgs/top-level/stage.nix28
2 files changed, 30 insertions, 27 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e1e2fab940c..dfa2a3b6696 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5,7 +5,7 @@
  * to merges. Please use the full-text search of your editor. ;)
  * Hint: ### starts category names.
  */
-{ lib, nixpkgsFun, noSysDirs, config}:
+{ lib, noSysDirs, config}:
 self: pkgs:
 
 with pkgs;
@@ -15,22 +15,6 @@ with pkgs;
   # Allow callPackage to fill in the pkgs argument
   inherit pkgs;
 
-
-  # Override system. This is useful to build i686 packages on x86_64-linux.
-  forceSystem = system: kernel: nixpkgsFun {
-    localSystem = {
-      inherit system;
-      platform = platform // { kernelArch = kernel; };
-    };
-  };
-
-  # Used by wine, firefox with debugging version of Flash, ...
-  pkgsi686Linux = forceSystem "i686-linux" "i386";
-
-  callPackage_i686 = if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
-    then pkgsi686Linux.callPackage
-    else throw "callPackage_i686 not supported on system '${stdenv.system}'";
-
   # A stdenv capable of building 32-bit binaries.  On x86_64-linux,
   # it uses GCC compiled with multilib support; on i686-linux, it's
   # just the plain stdenv.
@@ -2420,7 +2404,7 @@ with pkgs;
   fluentd = callPackage ../tools/misc/fluentd { };
 
   flvstreamer = callPackage ../tools/networking/flvstreamer { };
-  
+
   hmetis = callPackage_i686 ../applications/science/math/hmetis { };
 
   libbsd = callPackage ../development/libraries/libbsd { };
@@ -5889,14 +5873,7 @@ with pkgs;
   xbursttools = callPackage ../tools/misc/xburst-tools {
     # It needs a cross compiler for mipsel to build the firmware it will
     # load into the Ben Nanonote
-    gccCross =
-      let
-        pkgsCross = nixpkgsFun {
-          # Ben Nanonote system
-          crossSystem = lib.systems.examples.ben-nanonote;
-        };
-      in
-        pkgsCross.buildPackages.gccCrossStageStatic;
+    gccCross = pkgsCross.ben-nanonote.buildPackages.gccCrossStageStatic;
   };
 
   xclip = callPackage ../tools/misc/xclip { };
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index f9941a1c500..c209b05b09c 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -93,7 +93,7 @@ let
 
   allPackages = self: super:
     let res = import ./all-packages.nix
-      { inherit lib nixpkgsFun noSysDirs config; }
+      { inherit lib noSysDirs config; }
       res self;
     in res;
 
@@ -117,6 +117,31 @@ let
     lib.optionalAttrs allowCustomOverrides
       ((config.packageOverrides or (super: {})) super);
 
+  # Override system. This is useful to build i686 packages on x86_64-linux.
+  forceSystem = system: kernel: nixpkgsFun {
+    localSystem = {
+      inherit system;
+      platform = stdenv.hostPlatform.platform // { kernelArch = kernel; };
+    };
+  };
+
+  # Convenience attributes for instantitating nixpkgs. Each of these
+  # will instantiate a new version of allPackages. They map example
+  # attributes to their own thing.
+  extraPkgs = self: super: {
+     pkgsCross = lib.mapAttrs (n: crossSystem:
+                              nixpkgsFun { inherit crossSystem; })
+                              lib.systems.examples;
+     pkgsLocal = lib.mapAttrs (n: localSystem:
+                              nixpkgsFun { inherit localSystem; })
+                              lib.systems.examples;
+
+     # Used by wine, firefox with debugging version of Flash, ...
+     pkgsi686Linux = forceSystem "i686-linux" "i386";
+     callPackage_i686 = self.pkgsi686Linux.callPackage;
+     inherit forceSystem;
+  };
+
   # The complete chain of package set builders, applied from top to bottom.
   # stdenvOverlays must be last as it brings package forward from the
   # previous bootstrapping phases which have already been overlayed.
@@ -127,6 +152,7 @@ let
     trivialBuilders
     splice
     allPackages
+    extraPkgs
     aliases
     configOverrides
   ] ++ overlays ++ [