summary refs log tree commit diff
path: root/pkgs/top-level/stage.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/top-level/stage.nix')
-rw-r--r--pkgs/top-level/stage.nix60
1 files changed, 39 insertions, 21 deletions
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index c209b05b09c5..cc70950c497c 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -117,29 +117,47 @@ 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:
+  # Convenience attributes for instantitating package sets. Each of
+  # these will instantiate a new version of allPackages. Currently the
+  # following package sets are provided:
+  #
+  # - pkgsCross.<system> where system is a member of lib.systems.examples
+  # - pkgsMusl
+  # - pkgsi686Linux
+  otherPackageSets = self: super: {
+    # This maps each entry in lib.systems.examples to its own package
+    # set. Each of these will contain all packages cross compiled for
+    # that target system. For instance, pkgsCross.rasberryPi.hello,
+    # will refer to the "hello" package built for the ARM6-based
+    # Raspberry Pi.
+    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;
+    # All packages built with the Musl libc. This will override the
+    # default GNU libc on Linux systems. Non-Linux systems are not
+    # supported.
+    pkgsMusl = if stdenv.hostPlatform.isLinux then nixpkgsFun {
+      localSystem = {
+        parsed = stdenv.hostPlatform.parsed // {
+          abi = {
+            "gnu" = lib.systems.parse.abis.musl;
+            "gnueabi" = lib.systems.parse.abis.musleabi;
+            "gnueabihf" = lib.systems.parse.abis.musleabihf;
+          }.${stdenv.hostPlatform.parsed.abi.name} or lib.systems.parse.abis.musl;
+        };
+      };
+    } else throw "Musl libc only supports Linux systems.";
+
+    # All packages built for i686 Linux.
+    # Used by wine, firefox with debugging version of Flash, ...
+    pkgsi686Linux = assert stdenv.hostPlatform.isLinux; nixpkgsFun {
+      localSystem = {
+        parsed = stdenv.hostPlatform.parsed // {
+          cpu = lib.systems.parse.cpuTypes.i686;
+        };
+      };
+    };
   };
 
   # The complete chain of package set builders, applied from top to bottom.
@@ -152,7 +170,7 @@ let
     trivialBuilders
     splice
     allPackages
-    extraPkgs
+    otherPackageSets
     aliases
     configOverrides
   ] ++ overlays ++ [