summary refs log tree commit diff
path: root/pkgs/top-level/stage.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-07-05 16:16:26 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-07-05 16:17:54 -0400
commitf795ed79d026aafdc21685a99b762beb807a70a7 (patch)
tree423243adcdd4b0854de252cde3bb01c5092f7bd1 /pkgs/top-level/stage.nix
parent69f1045001a32a45de891f3c2264d09b1955a7f2 (diff)
downloadnixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar.gz
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar.bz2
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar.lz
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar.xz
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.tar.zst
nixpkgs-f795ed79d026aafdc21685a99b762beb807a70a7.zip
stage: Make `pkgsMusl` and `pkgsi686linux` respect the original localSystem more
For example:

nix-repl> pkgsi686Linux.pkgsMusl.hostPlatform.config
"i686-unknown-linux-musl"

nix-repl> pkgsMusl.pkgsi686Linux.hostPlatform.config
"i686-unknown-linux-musl"
Diffstat (limited to 'pkgs/top-level/stage.nix')
-rw-r--r--pkgs/top-level/stage.nix40
1 files changed, 19 insertions, 21 deletions
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 20770bd6f32..7b094c1c5ff 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -124,25 +124,7 @@ let
   # - pkgsCross.<system> where system is a member of lib.systems.examples
   # - pkgsMusl
   # - pkgsi686Linux
-  otherPackageSets = self: super: let
-    # Override default libc. Currently this is only useful on Linux
-    # systems where you have the choice between Musl & Glibc. In the
-    # future it may work for other things.
-    forceLibc = libc: nixpkgsFun {
-      localSystem = stdenv.hostPlatform // { inherit libc; };
-    };
-
-    # Override the system while preserving platform configuration.
-    # system refers to the system tuple. kernelArch refers to the
-    # kernel architecture used (only recognized by Linux kernels,
-    # currently).
-    forceSystem = system: kernelArch: nixpkgsFun {
-      localSystem = {
-        inherit system;
-        platform = stdenv.hostPlatform.platform // { inherit kernelArch; };
-      };
-    };
-  in {
+  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,
@@ -155,11 +137,27 @@ let
     # All packages built with the Musl libc. This will override the
     # default GNU libc on Linux systems. Non-Linux systems are not
     # supported.
-    pkgsMusl = forceLibc "musl";
+    pkgsMusl = 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;
+        };
+      };
+    };
 
     # All packages built for i686 Linux.
     # Used by wine, firefox with debugging version of Flash, ...
-    pkgsi686Linux = forceSystem "i686-linux" "i386";
+    pkgsi686Linux = nixpkgsFun {
+      localSystem = {
+        parsed = stdenv.hostPlatform.parsed // {
+          cpu = lib.systems.parse.cpuTypes.i686;
+        };
+      };
+    };
   };
 
   # The complete chain of package set builders, applied from top to bottom.