From f795ed79d026aafdc21685a99b762beb807a70a7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 5 Jul 2018 16:16:26 -0400 Subject: [PATCH] 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" --- pkgs/top-level/stage.nix | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 20770bd6f324..7b094c1c5ffd 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -124,25 +124,7 @@ let # - pkgsCross. 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.