summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-04-10 01:59:20 -0700
committersternenseemann <sternenseemann@systemli.org>2022-05-25 09:45:42 +0200
commitc0085404bd9dd6721eed9b6a5a36a310ca31b286 (patch)
tree8084a681e6887903cc3206bf581c7bcc0b0bf153 /pkgs
parentf3fdc04f112f73ecc3a84b147837cbaa680b8fdb (diff)
downloadnixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar.gz
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar.bz2
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar.lz
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar.xz
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.tar.zst
nixpkgs-c0085404bd9dd6721eed9b6a5a36a310ca31b286.zip
lib/systems/inspect.nix: remove isPowerPC
Very confusingly, the `isPowerPC` predicate in
`lib/systems/inspect.nix` does *not* match `powerpc64le`!

This is because `isPowerPC` is defined as

  isPowerPC      = { cpu = cpuTypes.powerpc; };

Where `cpuTypes.powerpc` is:

  { bits = 32; significantByte = bigEndian; family = "power"; };

This means that the `isPowerPC` predicate actually only matches the
subset of machines marketed under this name which happen to be 32-bit
and running in big-endian mode which is equivalent to:

  with stdenv.hostPlatform; isPower && isBigEndian && is32bit

This seems like a sharp edge that people could easily cut themselves
on.  In fact, that has already happened: in
`linux/kernel/common-config.nix` there is a test which will always
fail:

  (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit)

A more subtle case of the strict isPowerPC being used instead of the
moreg general isPower accidentally are the GHC expressions:

  Update pkgs/development/compilers/ghc/8.10.7.nix
  Update pkgs/development/compilers/ghc/8.8.4.nix
  Update pkgs/development/compilers/ghc/9.2.2.nix
  Update pkgs/development/compilers/ghc/9.0.2.nix
  Update pkgs/development/compilers/ghc/head.nix

Since the remaining legitimate use sites of isPowerPC are so few, remove
the isPowerPC predicate completely. The alternative expression above is
noted in the release notes as an alternative.

Co-authored-by: sternenseemann <sternenseemann@systemli.org>
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/ghc/8.10.7.nix2
-rw-r--r--pkgs/development/compilers/ghc/8.8.4.nix2
-rw-r--r--pkgs/development/compilers/ghc/9.0.2.nix2
-rw-r--r--pkgs/development/compilers/ghc/9.2.2.nix2
-rw-r--r--pkgs/development/compilers/ghc/head.nix2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix2
7 files changed, 7 insertions, 7 deletions
diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix
index cdf4faf3ffc..7a56d7c0e5c 100644
--- a/pkgs/development/compilers/ghc/8.10.7.nix
+++ b/pkgs/development/compilers/ghc/8.10.7.nix
@@ -12,7 +12,7 @@
   libffi ? null
 
 , useLLVM ? !(stdenv.targetPlatform.isx86
-              || stdenv.targetPlatform.isPowerPC
+              || stdenv.targetPlatform.isPower
               || stdenv.targetPlatform.isSparc)
 , # LLVM is conceptually a run-time-only depedendency, but for
   # non-x86, we need LLVM to bootstrap later stages, so it becomes a
diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix
index af01582b108..907d995a250 100644
--- a/pkgs/development/compilers/ghc/8.8.4.nix
+++ b/pkgs/development/compilers/ghc/8.8.4.nix
@@ -11,7 +11,7 @@
   libffi ? null
 
 , useLLVM ? !(stdenv.targetPlatform.isx86
-              || stdenv.targetPlatform.isPowerPC
+              || stdenv.targetPlatform.isPower
               || stdenv.targetPlatform.isSparc)
 , # LLVM is conceptually a run-time-only depedendency, but for
   # non-x86, we need LLVM to bootstrap later stages, so it becomes a
diff --git a/pkgs/development/compilers/ghc/9.0.2.nix b/pkgs/development/compilers/ghc/9.0.2.nix
index a4cefe7294d..6de0f201599 100644
--- a/pkgs/development/compilers/ghc/9.0.2.nix
+++ b/pkgs/development/compilers/ghc/9.0.2.nix
@@ -14,7 +14,7 @@
   libffi ? null
 
 , useLLVM ? !(stdenv.targetPlatform.isx86
-              || stdenv.targetPlatform.isPowerPC
+              || stdenv.targetPlatform.isPower
               || stdenv.targetPlatform.isSparc)
 , # LLVM is conceptually a run-time-only depedendency, but for
   # non-x86, we need LLVM to bootstrap later stages, so it becomes a
diff --git a/pkgs/development/compilers/ghc/9.2.2.nix b/pkgs/development/compilers/ghc/9.2.2.nix
index 0a572bff7ef..880db433789 100644
--- a/pkgs/development/compilers/ghc/9.2.2.nix
+++ b/pkgs/development/compilers/ghc/9.2.2.nix
@@ -13,7 +13,7 @@
   libffi ? null
 
 , useLLVM ? !(stdenv.targetPlatform.isx86
-              || stdenv.targetPlatform.isPowerPC
+              || stdenv.targetPlatform.isPower
               || stdenv.targetPlatform.isSparc
               || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin))
 , # LLVM is conceptually a run-time-only depedendency, but for
diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix
index a2afb7400c2..4f52ba0a618 100644
--- a/pkgs/development/compilers/ghc/head.nix
+++ b/pkgs/development/compilers/ghc/head.nix
@@ -19,7 +19,7 @@
 , elfutils # for DWARF support
 
 , useLLVM ? !(stdenv.targetPlatform.isx86
-              || stdenv.targetPlatform.isPowerPC
+              || stdenv.targetPlatform.isPower
               || stdenv.targetPlatform.isSparc
               || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin))
 , # LLVM is conceptually a run-time-only depedendency, but for
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index 0c1514d01c2..aa9f4e3763b 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -24,7 +24,7 @@ let
       flex bison python rsync
     ];
 
-    extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"];
+    extraIncludeDirs = lib.optional (with stdenvNoCC.hostPlatform; isPower && is32bit && isBigEndian) ["ppc"];
 
     inherit patches;
 
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index d25e20bac8b..4b6cceba238 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -29,7 +29,7 @@ let
     mkIf (stdenv.hostPlatform.isAarch32 ||
           stdenv.hostPlatform.isAarch64 ||
           stdenv.hostPlatform.isx86_64 ||
-          (stdenv.hostPlatform.isPowerPC && stdenv.hostPlatform.is64bit) ||
+          (stdenv.hostPlatform.isPower && stdenv.hostPlatform.is64bit) ||
           (stdenv.hostPlatform.isMips && stdenv.hostPlatform.is64bit));
 
   options = {