From bb5d0a47b738844d6e95768d995614062e22d119 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 21 Jul 2020 10:34:57 -0500 Subject: systems/examples.nix: update to iOS 13 new apps need iOS 13, so we should try to use that here --- lib/systems/examples.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 19b3790ecbe..3b32130f388 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -170,8 +170,8 @@ rec { iphone64 = { config = "aarch64-apple-ios"; # config = "aarch64-apple-darwin14"; - sdkVer = "12.4"; - xcodeVer = "10.3"; + sdkVer = "13.2"; + xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -180,8 +180,8 @@ rec { iphone32 = { config = "armv7a-apple-ios"; # config = "arm-apple-darwin10"; - sdkVer = "12.4"; - xcodeVer = "10.3"; + sdkVer = "13.2"; + xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -190,8 +190,8 @@ rec { iphone64-simulator = { config = "x86_64-apple-ios"; # config = "x86_64-apple-darwin14"; - sdkVer = "12.4"; - xcodeVer = "10.3"; + sdkVer = "13.2"; + xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; @@ -200,8 +200,8 @@ rec { iphone32-simulator = { config = "i686-apple-ios"; # config = "i386-apple-darwin11"; - sdkVer = "12.4"; - xcodeVer = "10.3"; + sdkVer = "13.2"; + xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; -- cgit 1.4.1 From cf7b63df5b9efdef4e8e1b3261d7040199f7e671 Mon Sep 17 00:00:00 2001 From: volth Date: Wed, 5 Aug 2020 02:32:41 +0000 Subject: gcc.arch: refactor, move tables under lib/ --- lib/systems/architectures.nix | 75 ++++++++++++++++++++++ lib/systems/default.nix | 2 + nixos/modules/services/misc/nix-daemon.nix | 11 +--- pkgs/applications/science/math/nauty/default.nix | 10 ++- pkgs/build-support/cc-wrapper/default.nix | 2 + pkgs/development/interpreters/j/default.nix | 2 +- pkgs/development/libraries/dlib/default.nix | 2 +- .../development/libraries/fflas-ffpack/default.nix | 33 ++++------ pkgs/development/libraries/g2o/default.nix | 17 ++--- pkgs/development/libraries/givaro/default.nix | 29 +++------ pkgs/development/libraries/linbox/default.nix | 30 +++------ pkgs/development/libraries/qt-5/modules/qtbase.nix | 33 ++++------ pkgs/development/python-modules/dlib/default.nix | 4 +- .../python-modules/tensorflow/1/default.nix | 6 +- .../python-modules/tensorflow/2/default.nix | 6 +- pkgs/servers/nosql/arangodb/default.nix | 12 +--- pkgs/tools/misc/cpuminer-multi/default.nix | 4 +- pkgs/tools/networking/i2pd/default.nix | 4 +- 18 files changed, 154 insertions(+), 128 deletions(-) create mode 100644 lib/systems/architectures.nix (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix new file mode 100644 index 00000000000..287f5be03c4 --- /dev/null +++ b/lib/systems/architectures.nix @@ -0,0 +1,75 @@ +{ lib }: + +rec { + # platform.gcc.arch to its features (as in /proc/cpuinfo) + features = { + default = [ ]; + # x86_64 Intel + westmere = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" ]; + sandybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + ivybridge = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + haswell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + broadwell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; + skylake-avx512 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + # x86_64 AMD + btver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ]; + btver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; + bdver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "fma" "fma4" ]; + bdver4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" "fma4" ]; + znver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + znver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + # a superior CPU has all the features of an inferior and is able to build and test code for it + inferiors = { + # x86_64 Intel + default = [ ]; + westmere = [ ]; + sandybridge = [ "westmere" ]; + ivybridge = [ "westmere" "sandybridge" ]; + haswell = [ "westmere" "sandybridge" "ivybridge" ]; + broadwell = [ "westmere" "sandybridge" "ivybridge" "haswell" ]; + skylake = [ "westmere" "sandybridge" "ivybridge" "haswell" "broadwell" ]; + skylake-avx512 = [ "westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" ]; + # x86_64 AMD + btver1 = [ ]; + btver2 = [ ]; + bdver1 = [ ]; + bdver2 = [ ]; + bdver3 = [ ]; + bdver4 = [ ]; + znver1 = [ ]; + znver2 = [ ]; + # other + armv5te = [ ]; + armv6 = [ ]; + armv7-a = [ ]; + armv8-a = [ ]; + mips32 = [ ]; + loongson2f = [ ]; + }; + + predicates = { + sse3Support = x: builtins.elem "sse3" features.${x}; + ssse3Support = x: builtins.elem "ssse3" features.${x}; + sse4_1Support = x: builtins.elem "sse4_1" features.${x}; + sse4_2Support = x: builtins.elem "sse4_2" features.${x}; + sse4_aSupport = x: builtins.elem "sse4a" features.${x}; + avxSupport = x: builtins.elem "avx" features.${x}; + avx2Support = x: builtins.elem "avx2" features.${x}; + avx512Support = x: builtins.elem "avx512" features.${x}; + aesSupport = x: builtins.elem "aes" features.${x}; + fmaSupport = x: builtins.elem "fma" features.${x}; + fma4Support = x: builtins.elem "fma4" features.${x}; + }; +} diff --git a/lib/systems/default.nix b/lib/systems/default.nix index c929781dd8f..02d58592b32 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -7,6 +7,7 @@ rec { inspect = import ./inspect.nix { inherit lib; }; platforms = import ./platforms.nix { inherit lib; }; examples = import ./examples.nix { inherit lib; }; + architectures = import ./architectures.nix { inherit lib; }; # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. @@ -125,6 +126,7 @@ rec { else throw "Don't know how to run ${final.config} executables."; } // mapAttrs (n: v: v final.parsed) inspect.predicates + // mapAttrs (n: v: v final.platform.gcc.arch or "default") architectures.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; assert lib.foldl diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 924a007efc6..37596e9c54d 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -595,15 +595,8 @@ in nix.systemFeatures = mkDefault ( [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ optionals (pkgs.stdenv.isx86_64 && pkgs.hostPlatform.platform ? gcc.arch) ( - # a x86_64 builder can run code for `platform.gcc.arch` and minor architectures: - [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ { - sandybridge = [ "gccarch-westmere" ]; - ivybridge = [ "gccarch-westmere" "gccarch-sandybridge" ]; - haswell = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" ]; - broadwell = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" ]; - skylake = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" ]; - skylake-avx512 = [ "gccarch-westmere" "gccarch-sandybridge" "gccarch-ivybridge" "gccarch-haswell" "gccarch-broadwell" "gccarch-skylake" ]; - }.${pkgs.hostPlatform.platform.gcc.arch} or [] + # a x86_64 builder can run code for `platform.gcc.arch` and inferior architectures: + [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch} ) ); diff --git a/pkgs/applications/science/math/nauty/default.nix b/pkgs/applications/science/math/nauty/default.nix index c1d408213b9..d75fc9731cd 100644 --- a/pkgs/applications/science/math/nauty/default.nix +++ b/pkgs/applications/science/math/nauty/default.nix @@ -10,15 +10,13 @@ stdenv.mkDerivation rec { sha256 = "1nym0p2djws8ylkpr0kgpxfa6fxdlh46cmvz0gn5vd02jzgs0aww"; }; outputs = [ "out" "dev" ]; - configureFlags = { + configureFlags = [ # Prevent nauty from sniffing some cpu features. While those are very # widely available, it can lead to nasty bugs when they are not available: # https://groups.google.com/forum/#!topic/sage-packaging/Pe4SRDNYlhA - default = [ "--disable-clz" "--disable-popcnt" ]; - westmere = [ "--disable-clz" ]; - sandybridge = [ "--disable-clz" ]; - ivybridge = [ "--disable-clz" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} or []; + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-popcnt" + "--${if stdenv.hostPlatform.sse4_aSupport then "enable" else "disable"}-clz" + ]; installPhase = '' mkdir -p "$out"/{bin,share/doc/nauty} "$dev"/{lib,include/nauty} diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index f8e25031c76..95826bd1d0f 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -72,6 +72,7 @@ let knm = versionAtLeast ccVersion "8.0"; # AMD znver1 = versionAtLeast ccVersion "6.0"; + znver2 = versionAtLeast ccVersion "9.0"; }.${arch} or true else if isClang then { # Intel @@ -81,6 +82,7 @@ let knm = versionAtLeast ccVersion "7.0"; # AMD znver1 = versionAtLeast ccVersion "4.0"; + znver2 = versionAtLeast ccVersion "9.0"; }.${arch} or true else false; diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix index 6df0d64bbeb..e2bf921f882 100644 --- a/pkgs/development/interpreters/j/default.nix +++ b/pkgs/development/interpreters/j/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub, readline, libedit, bc -, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] +, avxSupport ? stdenv.hostPlatform.avxSupport }: stdenv.mkDerivation rec { diff --git a/pkgs/development/libraries/dlib/default.nix b/pkgs/development/libraries/dlib/default.nix index 359e8a15f02..e584c3e9d9b 100644 --- a/pkgs/development/libraries/dlib/default.nix +++ b/pkgs/development/libraries/dlib/default.nix @@ -2,7 +2,7 @@ , guiSupport ? false, libX11 # see http://dlib.net/compile.html -, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] +, avxSupport ? stdenv.hostPlatform.avxSupport , cudaSupport ? true }: diff --git a/pkgs/development/libraries/fflas-ffpack/default.nix b/pkgs/development/libraries/fflas-ffpack/default.nix index 226d9c5e744..23b31fe439f 100644 --- a/pkgs/development/libraries/fflas-ffpack/default.nix +++ b/pkgs/development/libraries/fflas-ffpack/default.nix @@ -31,28 +31,21 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-blas-libs=-lcblas" "--with-lapack-libs=-llapacke" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) # for now we need to be careful to disable *all* relevant versions of an instruction set explicitly (https://github.com/linbox-team/fflas-ffpack/issues/284) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - # Intel - westmere = [ "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - # AMD - btver1 = [ "--disable-avx" "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" "--disable-fma" "--disable-fma4" ]; - btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - bdver1 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ]; - bdver2 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ]; - bdver3 = [ "--disable-avx2" "--disable-avx512f" "--disable-avx512dq" "--disable-avx512vl" ]; - bdver4 = [ ]; - znver1 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}; - + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512f" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512dq" + "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512vl" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ]; doCheck = true; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/g2o/default.nix b/pkgs/development/libraries/g2o/default.nix index 7167112b6bd..675d994cf0e 100644 --- a/pkgs/development/libraries/g2o/default.nix +++ b/pkgs/development/libraries/g2o/default.nix @@ -27,16 +27,13 @@ mkDerivation rec { # Detection script is broken "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer" "-DG2O_BUILD_EXAMPLES=OFF" - ] ++ lib.optionals stdenv.isx86_64 ([ "-DDO_SSE_AUTODETECT=OFF" ] ++ { - default = [ "-DDISABLE_SSE3=ON" "-DDISABLE_SSE4_1=ON" "-DDISABLE_SSE4_2=ON" "-DDISABLE_SSE4_A=ON" ]; - westmere = [ "-DDISABLE_SSE4_A=ON" ]; - sandybridge = [ "-DDISABLE_SSE4_A=ON" ]; - ivybridge = [ "-DDISABLE_SSE4_A=ON" ]; - haswell = [ "-DDISABLE_SSE4_A=ON" ]; - broadwell = [ "-DDISABLE_SSE4_A=ON" ]; - skylake = [ "-DDISABLE_SSE4_A=ON" ]; - skylake-avx512 = [ "-DDISABLE_SSE4_A=ON" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}); + ] ++ lib.optionals stdenv.isx86_64 [ + "-DDO_SSE_AUTODETECT=OFF" + "-DDISABLE_SSE3=${ if stdenv.hostPlatform.sse3Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_1=${if stdenv.hostPlatform.sse4_1Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_2=${if stdenv.hostPlatform.sse4_2Support then "OFF" else "ON"}" + "-DDISABLE_SSE4_A=${if stdenv.hostPlatform.sse4_aSupport then "OFF" else "ON"}" + ]; meta = with lib; { description = "A General Framework for Graph Optimization"; diff --git a/pkgs/development/libraries/givaro/default.nix b/pkgs/development/libraries/givaro/default.nix index b88d63c3d7e..78b6b088270 100644 --- a/pkgs/development/libraries/givaro/default.nix +++ b/pkgs/development/libraries/givaro/default.nix @@ -17,26 +17,17 @@ stdenv.mkDerivation rec { configureFlags = [ "--disable-optimization" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - # Intel - westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - # AMD - btver1 = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - bdver1 = [ "--disable-avx2" ]; - bdver2 = [ "--disable-avx2" ]; - bdver3 = [ "--disable-avx2" ]; - bdver4 = [ ]; - znver1 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"}; + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ]; # On darwin, tests are linked to dylib in the nix store, so we need to make # sure tests run after installPhase. diff --git a/pkgs/development/libraries/linbox/default.nix b/pkgs/development/libraries/linbox/default.nix index 0612a5be4ef..09bd7e12091 100644 --- a/pkgs/development/libraries/linbox/default.nix +++ b/pkgs/development/libraries/linbox/default.nix @@ -39,27 +39,17 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-blas-libs=-lblas" "--disable-optimization" - ] ++ stdenv.lib.optionals stdenv.isx86_64 { + ] ++ stdenv.lib.optionals stdenv.isx86_64 [ # disable SIMD instructions (which are enabled *when available* by default) - default = [ "--disable-sse3" "--disable-ssse3" "--disable-sse41" "--disable-sse42" "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - # Intel - westmere = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - sandybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - ivybridge = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - haswell = [ "--disable-fma4" ]; - broadwell = [ "--disable-fma4" ]; - skylake = [ "--disable-fma4" ]; - skylake-avx512 = [ "--disable-fma4" ]; - # AMD - btver1 = [ "--disable-avx" "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - btver2 = [ "--disable-avx2" "--disable-fma" "--disable-fma4" ]; - bdver1 = [ "--disable-avx2" ]; - bdver2 = [ "--disable-avx2" ]; - bdver3 = [ "--disable-avx2" ]; - bdver4 = [ ]; - znver1 = [ "--disable-fma4" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} - ++ stdenv.lib.optionals withSage [ + "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3" + "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3" + "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41" + "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42" + "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx" + "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2" + "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma" + "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4" + ] ++ stdenv.lib.optionals withSage [ "--enable-sage" ]; diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 33054dd403f..5eaca56684f 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -255,27 +255,18 @@ stdenv.mkDerivation { "-no-warnings-are-errors" ] ++ ( - if (!stdenv.hostPlatform.isx86_64) - then [ "-no-sse2" ] - else lib.optionals (compareVersion "5.9.0" >= 0) { - default = [ "-sse2" "-no-sse3" "-no-ssse3" "-no-sse4.1" "-no-sse4.2" "-no-avx" "-no-avx2" ]; - # Intel - westmere = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-no-avx" "-no-avx2" ]; - sandybridge = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - ivybridge = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - haswell = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - broadwell = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - skylake = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - skylake-avx512 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - # AMD - btver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-no-avx" "-no-avx2" ]; - btver2 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - bdver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - bdver2 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - bdver3 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-no-avx2" ]; - bdver4 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - znver1 = [ "-sse2" "-sse3" "-ssse3" "-sse4.1" "-sse4.2" "-avx" "-avx2" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or "default"} + if (!stdenv.hostPlatform.isx86_64) then [ + "-no-sse2" + ] else if (compareVersion "5.9.0" >= 0) then [ + "-sse2" + "${if stdenv.hostPlatform.sse3Support then "" else "-no"}-sse3" + "${if stdenv.hostPlatform.ssse3Support then "" else "-no"}-ssse3" + "${if stdenv.hostPlatform.sse4_1Support then "" else "-no"}-sse4.1" + "${if stdenv.hostPlatform.sse4_2Support then "" else "-no"}-sse4.2" + "${if stdenv.hostPlatform.avxSupport then "" else "-no"}-avx" + "${if stdenv.hostPlatform.avx2Support then "" else "-no"}-avx2" + ] else [ + ] ) ++ [ "-no-mips_dsp" diff --git a/pkgs/development/python-modules/dlib/default.nix b/pkgs/development/python-modules/dlib/default.nix index 33cb72dca40..027500ff2ab 100644 --- a/pkgs/development/python-modules/dlib/default.nix +++ b/pkgs/development/python-modules/dlib/default.nix @@ -1,5 +1,5 @@ -{ buildPythonPackage, lib, dlib, python, pytest, more-itertools, - avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] +{ buildPythonPackage, stdenv, lib, dlib, python, pytest, more-itertools +, avxSupport ? stdenv.hostPlatform.avxSupport }: buildPythonPackage { diff --git a/pkgs/development/python-modules/tensorflow/1/default.nix b/pkgs/development/python-modules/tensorflow/1/default.nix index 1633a32bee2..5f65004b3d6 100644 --- a/pkgs/development/python-modules/tensorflow/1/default.nix +++ b/pkgs/development/python-modules/tensorflow/1/default.nix @@ -23,9 +23,9 @@ , xlaSupport ? cudaSupport # Default from ./configure script , cudaCapabilities ? [ "3.5" "5.2" ] -, sse42Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] -, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver4" "znver1"] -, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver2" "bdver3" "bdver4" "znver1"] +, sse42Support ? stdenv.hostPlatform.sse4_2Support +, avx2Support ? stdenv.hostPlatform.avx2Support +, fmaSupport ? stdenv.hostPlatform.fmaSupport # Darwin deps , Foundation, Security }: diff --git a/pkgs/development/python-modules/tensorflow/2/default.nix b/pkgs/development/python-modules/tensorflow/2/default.nix index 8f30ecbcc98..eedd6e6d0df 100644 --- a/pkgs/development/python-modules/tensorflow/2/default.nix +++ b/pkgs/development/python-modules/tensorflow/2/default.nix @@ -23,9 +23,9 @@ , xlaSupport ? cudaSupport # Default from ./configure script , cudaCapabilities ? [ "3.5" "5.2" ] -, sse42Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") ["westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] -, avx2Support ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver4" "znver1"] -, fmaSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "haswell" "broadwell" "skylake" "skylake-avx512" "bdver2" "bdver3" "bdver4" "znver1"] +, sse42Support ? stdenv.hostPlatform.sse4_2Support +, avx2Support ? stdenv.hostPlatform.avx2Support +, fmaSupport ? stdenv.hostPlatform.fmaSupport # Darwin deps , Foundation, Security }: diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix index 54d5e8484bc..4d5c24c7304 100644 --- a/pkgs/servers/nosql/arangodb/default.nix +++ b/pkgs/servers/nosql/arangodb/default.nix @@ -32,15 +32,9 @@ let # do not set GCC's -march=xxx based on builder's /proc/cpuinfo "-DUSE_OPTIMIZE_FOR_ARCHITECTURE=OFF" # also avoid using builder's /proc/cpuinfo - ] ++ - { westmere = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - sandybridge = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - ivybridge = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - haswell = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - broadwell = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - skylake = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - skylake-avx512 = [ "-DHAVE_SSE42=ON" "-DASM_OPTIMIZATIONS=ON" ]; - }.${stdenv.hostPlatform.platform.gcc.arch or ""} or [ "-DHAVE_SSE42=OFF" "-DASM_OPTIMIZATIONS=OFF" ]; + "-DHAVE_SSE42=${if stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}" + "-DASM_OPTIMIZATIONS=${if stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}" + ]; enableParallelBuilding = true; diff --git a/pkgs/tools/misc/cpuminer-multi/default.nix b/pkgs/tools/misc/cpuminer-multi/default.nix index 65482fabb11..dba42e4bfea 100644 --- a/pkgs/tools/misc/cpuminer-multi/default.nix +++ b/pkgs/tools/misc/cpuminer-multi/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchgit, curl, jansson, autoconf, automake -, aesni ? true }: +, aesni ? stdenv.hostPlatform.aesSupport }: let rev = "8393e03089c0abde61bd5d72aba8f926c3d6eca4"; @@ -28,6 +28,6 @@ stdenv.mkDerivation { license = licenses.gpl2; maintainers = [ maintainers.ehmry ]; # does not build on i686 https://github.com/lucasjones/cpuminer-multi/issues/27 - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/tools/networking/i2pd/default.nix b/pkgs/tools/networking/i2pd/default.nix index 14fcde4367c..5f9f3ceef07 100644 --- a/pkgs/tools/networking/i2pd/default.nix +++ b/pkgs/tools/networking/i2pd/default.nix @@ -1,8 +1,8 @@ { stdenv, fetchFromGitHub , boost, zlib, openssl , upnpSupport ? true, miniupnpc ? null -, aesniSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] -, avxSupport ? builtins.elem (stdenv.hostPlatform.platform.gcc.arch or "default") [ "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" "skylake-avx512" "btver2" "bdver1" "bdver2" "bdver3" "bdver4" "znver1"] +, aesniSupport ? stdenv.hostPlatform.aesSupport +, avxSupport ? stdenv.hostPlatform.avxSupport }: assert upnpSupport -> miniupnpc != null; -- cgit 1.4.1 From 074bc78cc8749faa31729096b65f2ef51b10abeb Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 13 Aug 2020 01:10:21 -0400 Subject: android: update sdk, ndk to 29, 21 --- lib/systems/examples.nix | 4 ++-- pkgs/development/androidndk-pkgs/default.nix | 7 ++++--- pkgs/development/mobile/androidenv/compose-android-packages.nix | 2 +- pkgs/development/mobile/androidenv/ndk-bundle/default.nix | 6 ++++-- pkgs/top-level/all-packages.nix | 1 + 5 files changed, 12 insertions(+), 8 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index ca562d2e456..40e2b8fcefb 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -46,7 +46,7 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; - sdkVer = "24"; + sdkVer = "29"; ndkVer = "18b"; platform = platforms.armv7a-android; useAndroidPrebuilt = true; @@ -54,7 +54,7 @@ rec { aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; - sdkVer = "24"; + sdkVer = "29"; ndkVer = "18b"; platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; diff --git a/pkgs/development/androidndk-pkgs/default.nix b/pkgs/development/androidndk-pkgs/default.nix index 7bb779d1d13..ce5a868f4ec 100644 --- a/pkgs/development/androidndk-pkgs/default.nix +++ b/pkgs/development/androidndk-pkgs/default.nix @@ -2,9 +2,9 @@ }: { - "18b" = + "21" = let - ndkVersion = "18.1.5063045"; + ndkVersion = "21.0.6113669"; buildAndroidComposition = buildPackages.buildPackages.androidenv.composeAndroidPackages { includeNDK = true; @@ -28,6 +28,7 @@ # these two really are the same. buildAndroidndk = buildAndroidComposition.ndk-bundle; androidndk = androidComposition.ndk-bundle; - targetAndroidndkPkgs = targetPackages.androidndkPkgs_18b; + targetAndroidndkPkgs = targetPackages.androidndkPkgs_21; }; + } diff --git a/pkgs/development/mobile/androidenv/compose-android-packages.nix b/pkgs/development/mobile/androidenv/compose-android-packages.nix index f98547011bd..1786aebae83 100644 --- a/pkgs/development/mobile/androidenv/compose-android-packages.nix +++ b/pkgs/development/mobile/androidenv/compose-android-packages.nix @@ -14,7 +14,7 @@ , lldbVersions ? [ ] , cmakeVersions ? [ ] , includeNDK ? false -, ndkVersion ? "18.1.5063045" +, ndkVersion ? "21.0.6113669" , useGoogleAPIs ? false , useGoogleTVAddOns ? false , includeExtras ? [] diff --git a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix index b81fab1ed76..6bdb7181590 100644 --- a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix +++ b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix @@ -7,12 +7,14 @@ deployAndroidPackage { inherit package os; buildInputs = [ autoPatchelfHook makeWrapper pkgs.python2 ] ++ lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out ]; - patchInstructions = lib.optionalString (os == "linux") '' + patchInstructions = lib.optionalString (os == "linux") ('' patchShebangs . + '' + lib.optionalString (builtins.compareVersions (lib.getVersion package) "21" > 0) '' patch -p1 \ --no-backup-if-mismatch < ${./make_standalone_toolchain.py_18.patch} wrapProgram $(pwd)/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}" + '' + '' # TODO: allow this stuff rm -rf docs tests @@ -46,6 +48,6 @@ deployAndroidPackage { do ln -sf ../libexec/android-sdk/ndk-bundle/$i $out/bin/$i done - ''; + ''); noAuditTmpdir = true; # Audit script gets invoked by the build/ component in the path for the make standalone script } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 933a7544fb7..df2ca9f9d07 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1155,6 +1155,7 @@ in androidndkPkgs = androidndkPkgs_18b; androidndkPkgs_18b = (callPackage ../development/androidndk-pkgs {})."18b"; + androidndkPkgs_21 = (callPackage ../development/androidndk-pkgs {})."21"; androidsdk_9_0 = androidenv.androidPkgs_9_0.androidsdk; -- cgit 1.4.1 From 55bc2b54a481f08bd9f7189561f9cf2f65f810c7 Mon Sep 17 00:00:00 2001 From: volth Date: Sat, 22 Aug 2020 22:55:13 +0000 Subject: Update architectures.nix --- lib/systems/architectures.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index 287f5be03c4..ce7ac0356bd 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -35,12 +35,12 @@ rec { # x86_64 Intel default = [ ]; westmere = [ ]; - sandybridge = [ "westmere" ]; - ivybridge = [ "westmere" "sandybridge" ]; - haswell = [ "westmere" "sandybridge" "ivybridge" ]; - broadwell = [ "westmere" "sandybridge" "ivybridge" "haswell" ]; - skylake = [ "westmere" "sandybridge" "ivybridge" "haswell" "broadwell" ]; - skylake-avx512 = [ "westmere" "sandybridge" "ivybridge" "haswell" "broadwell" "skylake" ]; + sandybridge = [ "westmere" ] ++ inferiors.westmere; + ivybridge = [ "sandybridge" ] ++ inferiors.sandybridge; + haswell = [ "ivybridge" ] ++ inferiors.ivybridge; + broadwell = [ "haswell" ] ++ inferiors.haswell; + skylake = [ "broadwell" ] ++ inferiors.broadwell; + skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; # x86_64 AMD btver1 = [ ]; btver2 = [ ]; -- cgit 1.4.1 From 8ad48c921e6bc5b1a0a273764ef3337747b34503 Mon Sep 17 00:00:00 2001 From: volth Date: Sat, 22 Aug 2020 23:01:38 +0000 Subject: Update architectures.nix --- lib/systems/architectures.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index ce7ac0356bd..c9ca27a0651 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -43,13 +43,13 @@ rec { skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; # x86_64 AMD btver1 = [ ]; - btver2 = [ ]; - bdver1 = [ ]; - bdver2 = [ ]; - bdver3 = [ ]; - bdver4 = [ ]; - znver1 = [ ]; - znver2 = [ ]; + btver2 = [ ]; # TODO: fill this (need testing) + bdver1 = [ ]; # TODO: fill this (need testing) + bdver2 = [ ]; # TODO: fill this (need testing) + bdver3 = [ ]; # TODO: fill this (need testing) + bdver4 = [ ]; # TODO: fill this (need testing) + znver1 = [ ]; # TODO: fill this (need testing) + znver2 = [ ]; # TODO: fill this (need testing) # other armv5te = [ ]; armv6 = [ ]; -- cgit 1.4.1 From 60ce27db2b405c0de1b870b2d04056e71d704133 Mon Sep 17 00:00:00 2001 From: volth Date: Sat, 22 Aug 2020 23:04:08 +0000 Subject: Update architectures.nix --- lib/systems/architectures.nix | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index c9ca27a0651..acb6e417386 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -59,17 +59,18 @@ rec { loongson2f = [ ]; }; - predicates = { - sse3Support = x: builtins.elem "sse3" features.${x}; - ssse3Support = x: builtins.elem "ssse3" features.${x}; - sse4_1Support = x: builtins.elem "sse4_1" features.${x}; - sse4_2Support = x: builtins.elem "sse4_2" features.${x}; - sse4_aSupport = x: builtins.elem "sse4a" features.${x}; - avxSupport = x: builtins.elem "avx" features.${x}; - avx2Support = x: builtins.elem "avx2" features.${x}; - avx512Support = x: builtins.elem "avx512" features.${x}; - aesSupport = x: builtins.elem "aes" features.${x}; - fmaSupport = x: builtins.elem "fma" features.${x}; - fma4Support = x: builtins.elem "fma4" features.${x}; + predicates = rec { + featureSupport = feature: x: builtins.elem feature features.${x}; + sse3Support = featureSupport "sse3"; + ssse3Support = featureSupport "ssse3"; + sse4_1Support = featureSupport "sse4_1"; + sse4_2Support = featureSupport "sse4_2"; + sse4_aSupport = featureSupport "sse4a"; + avxSupport = featureSupport "avx"; + avx2Support = featureSupport "avx2"; + avx512Support = featureSupport "avx512"; + aesSupport = featureSupport "aes"; + fmaSupport = featureSupport "fma"; + fma4Support = featureSupport "fma4"; }; } -- cgit 1.4.1 From 55195119d529d65e264bcae9ce2741827272efb4 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Mon, 24 Aug 2020 21:46:48 -0400 Subject: Distinguish pkgsStatic from pkgsMusl via stdenv.targetPlatform This change allows derivations to distinguish dynamic musl build and static musl build in cases where upstream build system can't detect it by itself. --- lib/systems/default.nix | 1 + pkgs/top-level/stage.nix | 1 + 2 files changed, 2 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index c929781dd8f..09884d40682 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -76,6 +76,7 @@ rec { # uname -r release = null; }; + isStatic = final.isWasm || final.isRedox; kernelArch = if final.isAarch32 then "arm" diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 9e07d2bf061..58b0300cc79 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -215,6 +215,7 @@ let crossOverlays = [ (import ./static.nix) ]; } // lib.optionalAttrs stdenv.hostPlatform.isLinux { crossSystem = { + isStatic = true; parsed = stdenv.hostPlatform.parsed // { abi = { gnu = lib.systems.parse.abis.musl; -- cgit 1.4.1 From c5fe132b3c5da5044c01a9bd4aa4ab45795cb9e6 Mon Sep 17 00:00:00 2001 From: volth Date: Tue, 1 Sep 2020 11:28:34 +0000 Subject: Update architectures.nix --- lib/systems/architectures.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index acb6e417386..9d1c29fd9f0 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -59,8 +59,9 @@ rec { loongson2f = [ ]; }; - predicates = rec { + predicates = let featureSupport = feature: x: builtins.elem feature features.${x}; + in { sse3Support = featureSupport "sse3"; ssse3Support = featureSupport "ssse3"; sse4_1Support = featureSupport "sse4_1"; -- cgit 1.4.1 From e2bef8fbdc998c07c146db1d047a1e331e4f0517 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 8 Sep 2020 09:33:09 -0400 Subject: lib.systems.examples: Bump android SDK to 21 074bc78cc8749faa31729096b65f2ef51b10abeb evidently meant to do this, but forgot. --- lib/systems/examples.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 40e2b8fcefb..5403f73405c 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -47,7 +47,7 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; sdkVer = "29"; - ndkVer = "18b"; + ndkVer = "21"; platform = platforms.armv7a-android; useAndroidPrebuilt = true; }; @@ -55,7 +55,7 @@ rec { aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; sdkVer = "29"; - ndkVer = "18b"; + ndkVer = "21"; platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; -- cgit 1.4.1 From 8f3efbde4e5d5d5f6af97e8f7e199f37d51d9faa Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 9 Sep 2020 11:56:52 -0700 Subject: Fix arch eval error introduced in #61019 This occurs when using a `platform.gcc.arch` that isn't one of the pre-existing hard-coded options. --- lib/systems/architectures.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index 9d1c29fd9f0..bfecaec1ae8 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -60,7 +60,7 @@ rec { }; predicates = let - featureSupport = feature: x: builtins.elem feature features.${x}; + featureSupport = feature: x: builtins.elem feature features.${x} or []; in { sse3Support = featureSupport "sse3"; ssse3Support = featureSupport "ssse3"; -- cgit 1.4.1 From 4fc8c5098d28aa8980fe7f581121ddf731fdd901 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Mon, 24 Feb 2020 14:35:27 +0100 Subject: platforms: add bigEndian and littleEndian --- lib/systems/doubles.nix | 53 ++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index fb7d722e737..517a7296afd 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -50,32 +50,35 @@ in { none = []; - arm = filterDoubles predicates.isAarch32; - aarch64 = filterDoubles predicates.isAarch64; - x86 = filterDoubles predicates.isx86; - i686 = filterDoubles predicates.isi686; - x86_64 = filterDoubles predicates.isx86_64; - mips = filterDoubles predicates.isMips; - riscv = filterDoubles predicates.isRiscV; - vc4 = filterDoubles predicates.isVc4; - js = filterDoubles predicates.isJavaScript; - - cygwin = filterDoubles predicates.isCygwin; - darwin = filterDoubles predicates.isDarwin; - freebsd = filterDoubles predicates.isFreeBSD; + arm = filterDoubles predicates.isAarch32; + aarch64 = filterDoubles predicates.isAarch64; + x86 = filterDoubles predicates.isx86; + i686 = filterDoubles predicates.isi686; + x86_64 = filterDoubles predicates.isx86_64; + mips = filterDoubles predicates.isMips; + riscv = filterDoubles predicates.isRiscV; + vc4 = filterDoubles predicates.isVc4; + js = filterDoubles predicates.isJavaScript; + + bigEndian = filterDoubles predicates.isBigEndian; + littleEndian = filterDoubles predicates.isLittleEndian; + + cygwin = filterDoubles predicates.isCygwin; + darwin = filterDoubles predicates.isDarwin; + freebsd = filterDoubles predicates.isFreeBSD; # Should be better, but MinGW is unclear. - gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }); - illumos = filterDoubles predicates.isSunOS; - linux = filterDoubles predicates.isLinux; - netbsd = filterDoubles predicates.isNetBSD; - openbsd = filterDoubles predicates.isOpenBSD; - unix = filterDoubles predicates.isUnix; - wasi = filterDoubles predicates.isWasi; - redox = filterDoubles predicates.isRedox; - windows = filterDoubles predicates.isWindows; - genode = filterDoubles predicates.isGenode; - - embedded = filterDoubles predicates.isNone; + gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }); + illumos = filterDoubles predicates.isSunOS; + linux = filterDoubles predicates.isLinux; + netbsd = filterDoubles predicates.isNetBSD; + openbsd = filterDoubles predicates.isOpenBSD; + unix = filterDoubles predicates.isUnix; + wasi = filterDoubles predicates.isWasi; + redox = filterDoubles predicates.isRedox; + windows = filterDoubles predicates.isWindows; + genode = filterDoubles predicates.isGenode; + + embedded = filterDoubles predicates.isNone; mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"]; } -- cgit 1.4.1 From 6217cc92b513b5c66f1dbe38d9b8d2d6835ecbe6 Mon Sep 17 00:00:00 2001 From: Steven Pease Date: Thu, 15 Oct 2020 23:17:55 -0700 Subject: Add newer xcode versions --- lib/systems/examples.nix | 16 ++++++++-------- pkgs/os-specific/darwin/xcode/default.nix | 11 ++++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 87c05a0b052..5a31b8d91e4 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -179,8 +179,8 @@ rec { iphone64 = { config = "aarch64-apple-ios"; # config = "aarch64-apple-darwin14"; - sdkVer = "13.2"; - xcodeVer = "11.3.1"; + sdkVer = "14.0"; + xcodeVer = "12.0.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -189,8 +189,8 @@ rec { iphone32 = { config = "armv7a-apple-ios"; # config = "arm-apple-darwin10"; - sdkVer = "13.2"; - xcodeVer = "11.3.1"; + sdkVer = "14.0"; + xcodeVer = "12.0.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -199,8 +199,8 @@ rec { iphone64-simulator = { config = "x86_64-apple-ios"; # config = "x86_64-apple-darwin14"; - sdkVer = "13.2"; - xcodeVer = "11.3.1"; + sdkVer = "14.0"; + xcodeVer = "12.0.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; @@ -209,8 +209,8 @@ rec { iphone32-simulator = { config = "i686-apple-ios"; # config = "i386-apple-darwin11"; - sdkVer = "13.2"; - xcodeVer = "11.3.1"; + sdkVer = "14.0"; + xcodeVer = "12.0.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 34e3b2dfeea..7bb004958d5 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -53,6 +53,15 @@ in lib.makeExtensible (self: { xcode_10_2_1 = requireXcode "10.2.1" "11sdb54nr0x7kp987qq839x6k5gdx7vqdxjiy5xm5279n1n47bmg"; xcode_10_3 = requireXcode "10.3" "1i628vfn6zad81fsz3zpc6z15chhskvyp8qnajp2wnpzvrwl6ngb"; xcode_11 = requireXcode "11" "1r03j3kkp4blfp2kqpn538w3dx57ms930fj8apjkq6dk7fv3jcqh"; + xcode_11_1 = requireXcode "11.1" "1c2gzc4jhhx5a7ncg19sh1r99izhipybaqxl1ll52x5y8689awc1"; + xcode_11_2 = requireXcode "11.2" "1lm3q8zpvm184246h5j9mw4c1y9kk9sxnr3j98kfm0312n0l98gj"; + xcode_11_3 = requireXcode "11.3" "04rv6xlywy8xqfx9ma8ygsdw4yhckk2mq0qnklxnfly899iw4wza"; xcode_11_3_1 = requireXcode "11.3.1" "1p6nicj91kr6ad3rmycahd1i7z4hj7ccjs93ixsiximjzaahx3q4"; - xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (stdenv.targetPlatform ? xcodeVer) then stdenv.targetPlatform.xcodeVer else "11.3.1")}"; + xcode_11_4 = requireXcode "11.4" "065rpb3rdk19nv3rwyf9bk32ccbd0lld12gj12l89cyg65mhpyy7"; + xcode_11_5 = requireXcode "11.5" "1dizazq9nz1vjkc5gy7dd4x760mkfjiifk1hf6d9mscchdq8rfkw"; + xcode_11_6 = requireXcode "11.6" "1y4fhw1kiphzxdb4wpv697z5r0algvaldwq5iqv266797rnfql4x"; + xcode_11_7 = requireXcode "11.7" "0422rdc4j5qwyk59anbybxyfv0p26x0xryszm0wd8i44g66smlmj"; + xcode_12 = requireXcode "12" "1w3xm268pyn5m04wv22invd5kr2k4jqllgrzapv6n1sxxynxrh8z"; + xcode_12_0_1 = requireXcode "12.0.1" "1p6vd5ai0hh3cq6aflh4h21ar0shxnz8wlkaxwq7liwsdmkwzbl0"; + xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (stdenv.targetPlatform ? xcodeVer) then stdenv.targetPlatform.xcodeVer else "12.0.1")}"; }) -- cgit 1.4.1 From 445dde63041d516195926d2a2358541f9fbc8b7e Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Wed, 4 Nov 2020 21:13:06 +0700 Subject: Initial implementation of mmix cross-compile --- lib/systems/doubles.nix | 3 ++ lib/systems/examples.nix | 5 +++ lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 33 +++++++++++-------- lib/tests/systems.nix | 6 ++-- pkgs/build-support/bintools-wrapper/default.nix | 1 + pkgs/development/tools/mmixware/default.nix | 44 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 8 files changed, 79 insertions(+), 16 deletions(-) create mode 100644 pkgs/development/tools/mmixware/default.nix (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 517a7296afd..d8bfc48a96f 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -36,6 +36,8 @@ let "riscv64-none" "riscv32-none" "vc4-none" + "mmix-mmixware" + "js-ghcjs" "aarch64-genode" "i686-genode" "x86_64-genode" @@ -56,6 +58,7 @@ in { i686 = filterDoubles predicates.isi686; x86_64 = filterDoubles predicates.isx86_64; mips = filterDoubles predicates.isMips; + mmix = filterDoubles predicates.isMmix; riscv = filterDoubles predicates.isRiscV; vc4 = filterDoubles predicates.isVc4; js = filterDoubles predicates.isJavaScript; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 87c05a0b052..c869429d3ae 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -109,6 +109,11 @@ rec { platform = platforms.riscv-multiplatform "32"; }; + mmix = { + config = "mmix-unknown-mmixware"; + libc = "newlib"; + }; + msp430 = { config = "msp430-elf"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 8fa63057250..7adbc98f9a9 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -17,6 +17,7 @@ rec { isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; isMips = { cpu = { family = "mips"; }; }; + isMmix = { cpu = { family = "mmix"; }; }; isRiscV = { cpu = { family = "riscv"; }; }; isSparc = { cpu = { family = "sparc"; }; }; isWasm = { cpu = { family = "wasm"; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 6bd44a00746..6ba3c40c665 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -93,6 +93,8 @@ rec { mips64 = { bits = 64; significantByte = bigEndian; family = "mips"; }; mips64el = { bits = 64; significantByte = littleEndian; family = "mips"; }; + mmix = { bits = 64; significantByte = bigEndian; family = "mmix"; }; + powerpc = { bits = 32; significantByte = bigEndian; family = "power"; }; powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; }; powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; }; @@ -268,19 +270,20 @@ rec { kernels = with execFormats; with kernelFamilies; setTypes types.openKernel { # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as # the nnormalized name for macOS. - macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; - ios = { execFormat = macho; families = { inherit darwin; }; }; - freebsd = { execFormat = elf; families = { inherit bsd; }; }; - linux = { execFormat = elf; families = { }; }; - netbsd = { execFormat = elf; families = { inherit bsd; }; }; - none = { execFormat = unknown; families = { }; }; - openbsd = { execFormat = elf; families = { inherit bsd; }; }; - solaris = { execFormat = elf; families = { }; }; - wasi = { execFormat = wasm; families = { }; }; - redox = { execFormat = elf; families = { }; }; - windows = { execFormat = pe; families = { }; }; - ghcjs = { execFormat = unknown; families = { }; }; - genode = { execFormat = elf; families = { }; }; + macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; + ios = { execFormat = macho; families = { inherit darwin; }; }; + freebsd = { execFormat = elf; families = { inherit bsd; }; }; + linux = { execFormat = elf; families = { }; }; + netbsd = { execFormat = elf; families = { inherit bsd; }; }; + none = { execFormat = unknown; families = { }; }; + openbsd = { execFormat = elf; families = { inherit bsd; }; }; + solaris = { execFormat = elf; families = { }; }; + wasi = { execFormat = wasm; families = { }; }; + redox = { execFormat = elf; families = { }; }; + windows = { execFormat = pe; families = { }; }; + ghcjs = { execFormat = unknown; families = { }; }; + genode = { execFormat = elf; families = { }; }; + mmixware = { execFormat = unknown; families = { }; }; } // { # aliases # 'darwin' is the kernel for all of them. We choose macOS by default. darwin = kernels.macos; @@ -382,7 +385,7 @@ rec { else if (elemAt l 1) == "elf" then { cpu = elemAt l 0; vendor = "unknown"; kernel = "none"; abi = elemAt l 1; } else { cpu = elemAt l 0; kernel = elemAt l 1; }; - "3" = # Awkwards hacks, beware! + "3" = # Awkward hacks, beware! if elemAt l 1 == "apple" then { cpu = elemAt l 0; vendor = "apple"; kernel = elemAt l 2; } else if (elemAt l 1 == "linux") || (elemAt l 2 == "gnu") @@ -393,6 +396,8 @@ rec { then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "wasi"; } else if (elemAt l 2 == "redox") then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "redox"; } + else if (elemAt l 2 == "mmixware") + then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "mmixware"; } else if hasPrefix "netbsd" (elemAt l 2) then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"]) diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index f691b2da316..eed7ee725bc 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -11,12 +11,14 @@ let expr = lib.sort lib.lessThan x; expected = lib.sort lib.lessThan y; }; -in with lib.systems.doubles; lib.runTests { - testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ js ++ genode ++ redox); +in +with lib.systems.doubles; lib.runTests { + testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox); testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-none" "armv7a-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ]; testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; testmips = mseteq mips [ "mipsel-linux" ]; + testmmix = mseteq mmix [ "mmix-mmixware" ]; testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 786f0f9c598..9c5aef135fd 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -179,6 +179,7 @@ stdenv.mkDerivation { mips64 = "btsmip"; mips64el = "ltsmip"; }.${targetPlatform.parsed.cpu.name} + else if targetPlatform.isMmix then "mmix" else if targetPlatform.isPower then if targetPlatform.isBigEndian then "ppc" else "lppc" else if targetPlatform.isSparc then "sparc" else if targetPlatform.isMsp430 then "msp430" diff --git a/pkgs/development/tools/mmixware/default.nix b/pkgs/development/tools/mmixware/default.nix new file mode 100644 index 00000000000..0b0d394b4e1 --- /dev/null +++ b/pkgs/development/tools/mmixware/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchFromGitLab, tetex }: + +stdenv.mkDerivation { + pname = "mmixware"; + version = "unstable-2019-02-19"; + + src = fetchFromGitLab { + domain = "gitlab.lrz.de"; + owner = "mmix"; + repo = "mmixware"; + rev = "a330d68aafcfe739ecaaece888a669b8e7d9bcb8"; + sha256 = "0bq0d19vqhfbpk4mcqzmd0hygbkhapl1mzlfkcr6afx0fhlhi087"; + }; + + hardeningDisable = [ "format" ]; + + postPatch = '' + substituteInPlace Makefile --replace 'rm abstime.h' "" + ''; + + nativeBuildInputs = [ tetex ]; + enableParallelBuilding = true; + + makeFlags = [ "all" "doc" "CFLAGS=-O2" ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/doc + cp *.ps $out/share/doc + install -Dm755 mmixal -t $out/bin + install -Dm755 mmix -t $out/bin + install -Dm755 mmotype -t $out/bin + install -Dm755 mmmix -t $out/bin + runHook postInstall + ''; + + meta = with stdenv.lib; { + description = "MMIX simulator and assembler"; + homepage = "https://www-cs-faculty.stanford.edu/~knuth/mmix-news.html"; + maintainers = with maintainers; [ siraben ]; + platforms = platforms.unix; + license = licenses.publicDomain; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d017efe6dfb..e67708b4255 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5642,6 +5642,8 @@ in mmake = callPackage ../tools/misc/mmake { }; + mmixware = callPackage ../development/tools/mmixware { }; + modemmanager = callPackage ../tools/networking/modem-manager {}; modem-manager-gui = callPackage ../applications/networking/modem-manager-gui {}; -- cgit 1.4.1 From 6d8327ea96621b2d03aceee63df4fcdeea73e13a Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Mon, 9 Nov 2020 15:06:44 -0500 Subject: Initial support for OpenRISC 1000 (or1k) --- lib/systems/doubles.nix | 2 ++ lib/systems/examples.nix | 6 ++++++ lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 2 ++ pkgs/build-support/bintools-wrapper/default.nix | 1 + 5 files changed, 12 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 517a7296afd..5cd203efc4a 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -35,6 +35,7 @@ let "msp430-none" "riscv64-none" "riscv32-none" "vc4-none" + "or1k-none" "js-ghcjs" @@ -58,6 +59,7 @@ in { mips = filterDoubles predicates.isMips; riscv = filterDoubles predicates.isRiscV; vc4 = filterDoubles predicates.isVc4; + or1k = filterDoubles predicates.isOr1k; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 87c05a0b052..9a813b14cc2 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -124,6 +124,12 @@ rec { platform = {}; }; + or1k = { + config = "or1k-elf"; + libc = "newlib"; + platform = {}; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index 8fa63057250..ac483941dd2 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -24,6 +24,7 @@ rec { isVc4 = { cpu = { family = "vc4"; }; }; isAvr = { cpu = { family = "avr"; }; }; isAlpha = { cpu = { family = "alpha"; }; }; + isOr1k = { cpu = { family = "or1k"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 6bd44a00746..eadeb38c723 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -114,6 +114,8 @@ rec { vc4 = { bits = 32; significantByte = littleEndian; family = "vc4"; }; + or1k = { bits = 32; significantByte = bigEndian; family = "or1k"; }; + js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 786f0f9c598..b9cdd0b1b2e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -185,6 +185,7 @@ stdenv.mkDerivation { else if targetPlatform.isAvr then "avr" else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isVc4 then "vc4" + else if targetPlatform.isOr1k then "or1k" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); -- cgit 1.4.1 From 837fe2e49168efa07c8d0de54b72c7fefd9181dc Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 22 Nov 2020 22:08:18 -0500 Subject: platforms.nix: Remove now unused kernelMajor The last use of `kernelMajor` in Nixpkgs was removed in 2018. Even then, I'm not positive it was actually in an exercised code path. AFAIUI this is now totally redundant and useless as it really was meant for the 2.4 -> 2.6 transition. --- lib/systems/platforms.nix | 8 -------- 1 file changed, 8 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index ab3cf1d5430..b539af915b1 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -47,7 +47,6 @@ rec { arch = "armv5te"; }; - kernelMajor = "2.6"; kernelBaseConfig = "multi_v5_defconfig"; kernelArch = "arm"; kernelAutoModules = false; @@ -70,7 +69,6 @@ rec { sheevaplug = { name = "sheevaplug"; - kernelMajor = "2.6"; kernelBaseConfig = "multi_v5_defconfig"; kernelArch = "arm"; kernelAutoModules = false; @@ -182,7 +180,6 @@ rec { raspberrypi = { name = "raspberrypi"; - kernelMajor = "2.6"; kernelBaseConfig = "bcm2835_defconfig"; kernelDTB = true; kernelArch = "arm"; @@ -212,7 +209,6 @@ rec { utilite = { name = "utilite"; - kernelMajor = "2.6"; kernelBaseConfig = "multi_v7_defconfig"; kernelArch = "arm"; kernelAutoModules = false; @@ -265,7 +261,6 @@ rec { armv7l-hf-multiplatform = { name = "armv7l-hf-multiplatform"; - kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc. kernelBaseConfig = "multi_v7_defconfig"; kernelArch = "arm"; kernelDTB = true; @@ -313,7 +308,6 @@ rec { aarch64-multiplatform = { name = "aarch64-multiplatform"; - kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc. kernelBaseConfig = "defconfig"; kernelArch = "arm64"; kernelDTB = true; @@ -352,7 +346,6 @@ rec { ben_nanonote = { name = "ben_nanonote"; - kernelMajor = "2.6"; kernelArch = "mips"; gcc = { arch = "mips32"; @@ -362,7 +355,6 @@ rec { fuloong2f_n32 = { name = "fuloong2f_n32"; - kernelMajor = "2.6"; kernelBaseConfig = "lemote2f_defconfig"; kernelArch = "mips"; kernelAutoModules = false; -- cgit 1.4.1 From 77e00150baac819fc605e81a8828a1e76cf841b2 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Wed, 18 Nov 2020 09:48:08 +0700 Subject: Initial implementation of remarkable1 cross-compile --- lib/systems/examples.nix | 5 +++++ lib/systems/platforms.nix | 14 ++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index b824bea6c20..3bbe61ed33a 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -34,6 +34,11 @@ rec { platform = platforms.raspberrypi; }; + remarkable1 = { + config = "armv7l-unknown-linux-gnueabihf"; + platform = platforms.zero-gravitas; + }; + armv7l-hf-multiplatform = { config = "armv7l-unknown-linux-gnueabihf"; platform = platforms.armv7l-hf-multiplatform; diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index ab3cf1d5430..42d9809fd7d 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -203,6 +203,20 @@ rec { # Legacy attribute, for compatibility with existing configs only. raspberrypi2 = armv7l-hf-multiplatform; + zero-gravitas = { + name = "zero-gravitas"; + kernelBaseConfig = "zero-gravitas_defconfig"; + kernelArch = "arm"; + # kernelTarget verified by checking /boot on reMarkable 1 device + kernelTarget = "zImage"; + kernelAutoModules = false; + kernelDTB = true; + gcc = { + fpu = "neon"; + cpu = "cortex-a9"; + }; + }; + scaleway-c1 = armv7l-hf-multiplatform // { gcc = { cpu = "cortex-a9"; -- cgit 1.4.1 From 40e7be11c8098d11217786d106462e958e1d8718 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 28 Nov 2020 20:55:55 +0000 Subject: lib.systems.platforms: Make selection more flexible We dont have to match on exact strings if we get accessed to `parsed`. Co-authored-by: Matthew Bauer --- lib/systems/default.nix | 2 +- lib/systems/platforms.nix | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 9939743157e..f6832945a23 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -25,7 +25,7 @@ rec { system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; # Just a guess, based on `system` - platform = platforms.selectBySystem final.system; + platform = platforms.select final; # Determine whether we are compatible with the provided CPU isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu; # Derived meta-data diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 42d9809fd7d..a01f167a02b 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -469,17 +469,22 @@ rec { ''; }; - selectBySystem = system: { - i486-linux = pc32; - i586-linux = pc32; - i686-linux = pc32; - x86_64-linux = pc64; - armv5tel-linux = sheevaplug; - armv6l-linux = raspberrypi; - armv7a-linux = armv7l-hf-multiplatform; - armv7l-linux = armv7l-hf-multiplatform; - aarch64-linux = aarch64-multiplatform; - mipsel-linux = fuloong2f_n32; - powerpc64le-linux = powernv; - }.${system} or pcBase; + select = platform: + # x86 + /**/ if platform.isx86_32 then pc32 + else if platform.isx86_64 then pc64 + + # ARM + else if platform.isAarch32 then let + version = platform.parsed.cpu.version or ""; + in if lib.versionOlder version "6" then sheevaplug + else if lib.versionOlder version "7" then raspberrypi + else armv7l-hf-multiplatform + else if platform.isAarch64 then aarch64-multiplatform + + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32 + + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv + + else pcBase; } -- cgit 1.4.1 From 04f6973200954f9ecd0f2fbc1d6ae029cd7ed857 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 28 Nov 2020 21:57:00 +0000 Subject: lib, binutils: Move Risc-V bfdEmulation to be by the others --- lib/systems/platforms.nix | 1 - pkgs/build-support/bintools-wrapper/default.nix | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index a01f167a02b..b3a4f9fc13c 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -459,7 +459,6 @@ rec { riscv-multiplatform = bits: { name = "riscv-multiplatform"; kernelArch = "riscv"; - bfdEmulation = "elf${bits}lriscv"; kernelTarget = "vmlinux"; kernelAutoModules = true; kernelBaseConfig = "defconfig"; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 3b1b8ff570a..6da0e58436d 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -167,7 +167,7 @@ stdenv.mkDerivation { else if targetPlatform.isWindows then "pe" else "elf" + toString targetPlatform.parsed.cpu.bits; endianPrefix = if targetPlatform.isBigEndian then "big" else "little"; - sep = optionalString (!targetPlatform.isMips && !targetPlatform.isPower) "-"; + sep = optionalString (!targetPlatform.isMips && !targetPlatform.isPower && !targetPlatform.isRiscV) "-"; arch = /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64" else if targetPlatform.isAarch32 then endianPrefix + "arm" @@ -187,6 +187,7 @@ stdenv.mkDerivation { else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isVc4 then "vc4" else if targetPlatform.isOr1k then "or1k" + else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); -- cgit 1.4.1 From 9918ba2dbaf2d6533baa53330a9ef9c32cfbf8a5 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 28 Nov 2020 22:15:10 +0000 Subject: lib/systems/exmaple: `riscv-multiplatform` no longer needs parameter --- lib/systems/examples.nix | 6 +++--- lib/systems/platforms.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 3bbe61ed33a..12c63c9bd5e 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -7,7 +7,7 @@ let riscv = bits: { config = "riscv${bits}-unknown-linux-gnu"; - platform = platforms.riscv-multiplatform bits; + platform = platforms.riscv-multiplatform; }; in @@ -105,13 +105,13 @@ rec { riscv64-embedded = { config = "riscv64-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform "64"; + platform = platforms.riscv-multiplatform; }; riscv32-embedded = { config = "riscv32-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform "32"; + platform = platforms.riscv-multiplatform; }; mmix = { diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index b3a4f9fc13c..6b9e258d4f0 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -456,7 +456,7 @@ rec { ## Other ## - riscv-multiplatform = bits: { + riscv-multiplatform = { name = "riscv-multiplatform"; kernelArch = "riscv"; kernelTarget = "vmlinux"; -- cgit 1.4.1 From 454df2b0c36161de67c3f143ab85fb16c33c23f2 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Sun, 29 Nov 2020 23:01:58 -0800 Subject: Cross-compiling configuration for reMarkable 2 tablet --- lib/systems/examples.nix | 5 +++++ lib/systems/platforms.nix | 15 +++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 3bbe61ed33a..2476c3541b1 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -39,6 +39,11 @@ rec { platform = platforms.zero-gravitas; }; + remarkable2 = { + config = "armv7l-unknown-linux-gnueabihf"; + platform = platforms.zero-sugar; + }; + armv7l-hf-multiplatform = { config = "armv7l-unknown-linux-gnueabihf"; platform = platforms.armv7l-hf-multiplatform; diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 42d9809fd7d..7097e147966 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -217,6 +217,21 @@ rec { }; }; + zero-sugar = { + name = "zero-sugar"; + kernelBaseConfig = "zero-sugar_defconfig"; + kernelArch = "arm"; + kernelDTB = true; + kernelAutoModules = false; + kernelPreferBuiltin = true; + kernelTarget = "zImage"; + gcc = { + cpu = "cortex-a7"; + fpu = "neon-vfpv4"; + float-abi = "hard"; + }; + }; + scaleway-c1 = armv7l-hf-multiplatform // { gcc = { cpu = "cortex-a9"; -- cgit 1.4.1 From 2ee35e1fcecdae598651fd9b1452f451ac221384 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Thu, 3 Sep 2020 15:58:10 +0200 Subject: lib/systems: fix kernelArch for x86_64 IA64 (Itanium) is something completely different and certainly not what we want! x86_64 code lives in arch/x86 just like "classic" x86. --- lib/systems/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index f6832945a23..e31a8e65f2a 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -83,7 +83,7 @@ rec { if final.isAarch32 then "arm" else if final.isAarch64 then "arm64" else if final.isx86_32 then "x86" - else if final.isx86_64 then "ia64" + else if final.isx86_64 then "x86" else if final.isMips then "mips" else final.parsed.cpu.name; -- cgit 1.4.1 From 2a9ac172c1b979504b165830ef8e374f2efc3051 Mon Sep 17 00:00:00 2001 From: Fabián Heredia Montiel Date: Wed, 23 Dec 2020 18:02:10 -0600 Subject: lib.systems: update processor architecture info --- lib/systems/architectures.nix | 44 ++++++++++++++++++++++++++----- pkgs/build-support/cc-wrapper/default.nix | 4 +++ 2 files changed, 41 insertions(+), 7 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index bfecaec1ae8..8e3a56b0d7c 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -12,6 +12,12 @@ rec { broadwell = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; skylake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "fma" ]; skylake-avx512 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + cannonlake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + icelake-client = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + icelake-server = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + cascadelake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + cooperlake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; + tigerlake = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" "avx2" "avx512" "fma" ]; # x86_64 AMD btver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ]; btver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" "avx" ]; @@ -21,6 +27,7 @@ rec { bdver4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" "fma4" ]; znver1 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; znver2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; + znver3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "sse4a" "aes" "avx" "avx2" "fma" ]; # other armv5te = [ ]; armv6 = [ ]; @@ -41,15 +48,38 @@ rec { broadwell = [ "haswell" ] ++ inferiors.haswell; skylake = [ "broadwell" ] ++ inferiors.broadwell; skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; + # x86_64 AMD + # TODO: fill this (need testing) btver1 = [ ]; - btver2 = [ ]; # TODO: fill this (need testing) - bdver1 = [ ]; # TODO: fill this (need testing) - bdver2 = [ ]; # TODO: fill this (need testing) - bdver3 = [ ]; # TODO: fill this (need testing) - bdver4 = [ ]; # TODO: fill this (need testing) - znver1 = [ ]; # TODO: fill this (need testing) - znver2 = [ ]; # TODO: fill this (need testing) + btver2 = [ ]; + bdver1 = [ ]; + bdver2 = [ ]; + bdver3 = [ ]; + bdver4 = [ ]; + # Regarding `skylake` as inferior of `znver1`, there are reports of + # successful usage by Gentoo users and Phoronix benchmarking of different + # `-march` targets. + # + # The GCC documentation on extensions used and wikichip documentation + # regarding supperted extensions on znver1 and skylake was used to create + # this partial order. + # + # Note: + # + # - The succesors of `skylake` (`cannonlake`, `icelake`, etc) use `avx512` + # which no current AMD Zen michroarch support. + # - `znver1` uses `ABM`, `CLZERO`, `CX16`, `MWAITX`, and `SSE4A` which no + # current Intel microarch support. + # + # https://www.phoronix.com/scan.php?page=article&item=amd-znver3-gcc11&num=1 + # https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html + # https://en.wikichip.org/wiki/amd/microarchitectures/zen + # https://en.wikichip.org/wiki/intel/microarchitectures/skylake + znver1 = [ "skylake" ] ++ inferiors.skylake; + znver2 = [ "znver1" ] ++ inferiors.znver1; + znver3 = [ "znver2" ] ++ inferiors.znver2; + # other armv5te = [ ]; armv6 = [ ]; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 09cef8b8678..bd1932d6403 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -76,10 +76,14 @@ let cannonlake = versionAtLeast ccVersion "8.0"; icelake-client = versionAtLeast ccVersion "8.0"; icelake-server = versionAtLeast ccVersion "8.0"; + cascadelake = versionAtLeast ccVersion "9.0"; + cooperlake = versionAtLeast ccVersion "10.0"; + tigerlake = versionAtLeast ccVersion "10.0"; knm = versionAtLeast ccVersion "8.0"; # AMD znver1 = versionAtLeast ccVersion "6.0"; znver2 = versionAtLeast ccVersion "9.0"; + znver3 = versionAtLeast ccVersion "11.0"; }.${arch} or true else if isClang then { # Intel -- cgit 1.4.1 From a44aec2b1b02df43f9e90f39a92a30b30de97e84 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Thu, 31 Dec 2020 00:06:31 +0100 Subject: lib/systems/platforms: treat missing cpu version as generic pcBase Since 40e7be1 all ARM platforms that didn't have a parsed cpu version (e.g. arm-none-eabi) would be handled as armv7l-hf-multiplatform which did break building arm-trusted-platform packages for some targets (e.g. rk3399). Using pcBase as fallback, instead of armv7l-hf-multiplatform, corresponds with the behaviour we had before 40e7be1. --- lib/systems/platforms.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index a0dccc85988..fdd127e5541 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -490,8 +490,9 @@ rec { # ARM else if platform.isAarch32 then let - version = platform.parsed.cpu.version or ""; - in if lib.versionOlder version "6" then sheevaplug + version = platform.parsed.cpu.version or null; + in if version == null then pcBase + else if lib.versionOlder version "6" then sheevaplug else if lib.versionOlder version "7" then raspberrypi else armv7l-hf-multiplatform else if platform.isAarch64 then aarch64-multiplatform -- cgit 1.4.1 From b77ca83282ca5980fc593c0d703b12af04a5c01f Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Thu, 31 Dec 2020 13:21:35 +0700 Subject: lib/systems: add emulator for mmix --- lib/systems/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index e31a8e65f2a..4edcbeb36f1 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -124,6 +124,8 @@ rec { then "${qemu-user}/bin/qemu-${final.qemuArch}" else if final.isWasi then "${pkgs.wasmtime}/bin/wasmtime" + else if final.isMmix + then "${pkgs.mmixware}/bin/mmix" else throw "Don't know how to run ${final.config} executables."; } // mapAttrs (n: v: v final.parsed) inspect.predicates -- cgit 1.4.1 From d8c1c0dc501855658ef3f4bf6a896c82730fe806 Mon Sep 17 00:00:00 2001 From: Steven Pease Date: Tue, 19 Jan 2021 20:41:39 -0800 Subject: Update to XCode 12.3 --- lib/systems/examples.nix | 16 ++++++++-------- pkgs/os-specific/darwin/xcode/default.nix | 12 ++++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 5a31b8d91e4..9f090655747 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -179,8 +179,8 @@ rec { iphone64 = { config = "aarch64-apple-ios"; # config = "aarch64-apple-darwin14"; - sdkVer = "14.0"; - xcodeVer = "12.0.1"; + sdkVer = "14.3"; + xcodeVer = "12.3"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -189,8 +189,8 @@ rec { iphone32 = { config = "armv7a-apple-ios"; # config = "arm-apple-darwin10"; - sdkVer = "14.0"; - xcodeVer = "12.0.1"; + sdkVer = "14.3"; + xcodeVer = "12.3"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; platform = {}; @@ -199,8 +199,8 @@ rec { iphone64-simulator = { config = "x86_64-apple-ios"; # config = "x86_64-apple-darwin14"; - sdkVer = "14.0"; - xcodeVer = "12.0.1"; + sdkVer = "14.3"; + xcodeVer = "12.3"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; @@ -209,8 +209,8 @@ rec { iphone32-simulator = { config = "i686-apple-ios"; # config = "i386-apple-darwin11"; - sdkVer = "14.0"; - xcodeVer = "12.0.1"; + sdkVer = "14.3"; + xcodeVer = "12.3"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; platform = {}; diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 7bb004958d5..a96d7256968 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -1,10 +1,10 @@ -{ stdenv, requireFile, lib }: +{ requireFile, targetPlatform, lib }: let requireXcode = version: sha256: let xip = "Xcode_" + version + ".xip"; # TODO(alexfmpe): Find out how to validate the .xip signature in Linux - unxip = if stdenv.isDarwin + unxip = if targetPlatform.isDarwin then '' open -W ${xip} rm -rf ${xip} @@ -31,7 +31,7 @@ let requireXcode = version: sha256: rm -rf Xcode.app ''; }; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://developer.apple.com/downloads/"; description = "Apple's XCode SDK"; license = licenses.unfree; @@ -63,5 +63,9 @@ in lib.makeExtensible (self: { xcode_11_7 = requireXcode "11.7" "0422rdc4j5qwyk59anbybxyfv0p26x0xryszm0wd8i44g66smlmj"; xcode_12 = requireXcode "12" "1w3xm268pyn5m04wv22invd5kr2k4jqllgrzapv6n1sxxynxrh8z"; xcode_12_0_1 = requireXcode "12.0.1" "1p6vd5ai0hh3cq6aflh4h21ar0shxnz8wlkaxwq7liwsdmkwzbl0"; - xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (stdenv.targetPlatform ? xcodeVer) then stdenv.targetPlatform.xcodeVer else "12.0.1")}"; + xcode_12_1 = requireXcode "12.1" "1widy74dk43wx8iqgd7arzf6q4kzdmaz8pfwymzs8chnq9dqr3wp"; + xcode_12_2 = requireXcode "12.2" "17i0wf4pwrxwfgjw7rpw9mcd59nkmys1k5h2rqsw81snzyxy9j0v"; + xcode_12_3 = requireXcode "12.3" "0kwf1y4llysf1p0nsbqyzccn7d77my0ldagr5fi3by4k0xy3d189"; + xcode = self."xcode_${lib.replaceStrings ["."] ["_"] (if (targetPlatform ? xcodeVer) then targetPlatform.xcodeVer else "12.3")}"; }) + -- cgit 1.4.1 From 8929989614589ee3acd070a6409b2b9700c92d65 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 29 Nov 2020 00:01:14 +0000 Subject: lib: Clean up how linux and gcc config is specified The `platform` field is pointless nesting: it's just stuff that happens to be defined together, and that should be an implementation detail. This instead makes `linux-kernel` and `gcc` top level fields in platform configs. They join `rustc` there [all are optional], which was put there and not in `platform` in anticipation of a change like this. `linux-kernel.arch` in particular also becomes `linuxArch`, to match the other `*Arch`es. The next step after is this to combine the *specific* machines from `lib.systems.platforms` with `lib.systems.examples`, keeping just the "multiplatform" ones for defaulting. --- lib/systems/default.nix | 13 +- lib/systems/examples.nix | 48 +- lib/systems/platforms.nix | 670 +++++++++++---------- nixos/doc/manual/release-notes/rl-2103.xml | 16 + nixos/modules/hardware/device-tree.nix | 8 +- nixos/modules/installer/netboot/netboot.nix | 2 +- nixos/modules/services/misc/nix-daemon.nix | 8 +- nixos/modules/system/activation/top-level.nix | 2 +- .../loader/generations-dir/generations-dir.nix | 2 +- .../system/boot/loader/raspberrypi/raspberrypi.nix | 2 +- nixos/release.nix | 4 +- pkgs/applications/audio/virtual-ans/default.nix | 2 +- .../applications/virtualization/crosvm/default.nix | 2 +- pkgs/applications/virtualization/vpcs/default.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 2 +- pkgs/build-support/cc-wrapper/default.nix | 16 +- pkgs/build-support/kernel/make-initrd.nix | 4 +- pkgs/build-support/vm/default.nix | 2 +- .../compilers/gcc/common/platform-flags.nix | 2 +- pkgs/development/compilers/julia/1.0.nix | 2 +- pkgs/development/compilers/julia/1.3.nix | 2 +- pkgs/development/compilers/julia/1.5.nix | 2 +- pkgs/development/libraries/glibc/common.nix | 2 +- .../libraries/qt-5/modules/qtwebengine.nix | 2 +- .../tools/poetry2nix/poetry2nix/pep425.nix | 6 +- .../tools/poetry2nix/poetry2nix/pep508.nix | 2 +- pkgs/development/web/nodejs/nodejs.nix | 11 +- pkgs/os-specific/linux/exfat/default.nix | 2 +- pkgs/os-specific/linux/kernel-headers/default.nix | 2 +- pkgs/os-specific/linux/kernel/generic.nix | 18 +- pkgs/os-specific/linux/kernel/manual-config.nix | 30 +- pkgs/os-specific/linux/klibc/default.nix | 4 +- pkgs/os-specific/linux/rtl8723bs/default.nix | 2 +- pkgs/os-specific/linux/rtl8812au/default.nix | 2 +- pkgs/os-specific/linux/uclibc/default.nix | 2 +- pkgs/stdenv/generic/make-derivation.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 37 files changed, 454 insertions(+), 448 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 4edcbeb36f1..84d0b34805a 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -24,8 +24,6 @@ rec { # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; - # Just a guess, based on `system` - platform = platforms.select final; # Determine whether we are compatible with the provided CPU isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu; # Derived meta-data @@ -79,7 +77,16 @@ rec { }; isStatic = final.isWasm || final.isRedox; - kernelArch = + # Just a guess, based on `system` + inherit + ({ + linux-kernel = args.linux-kernel or {}; + gcc = args.gcc or {}; + rustc = args.rust or {}; + } // platforms.select final) + linux-kernel gcc rustc; + + linuxArch = if final.isAarch32 then "arm" else if final.isAarch64 then "arm64" else if final.isx86_32 then "x86" diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 16002450f2d..de12e0b83c1 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -7,7 +7,6 @@ let riscv = bits: { config = "riscv${bits}-unknown-linux-gnu"; - platform = platforms.riscv-multiplatform; }; in @@ -17,84 +16,68 @@ rec { # powernv = { config = "powerpc64le-unknown-linux-gnu"; - platform = platforms.powernv; }; musl-power = { config = "powerpc64le-unknown-linux-musl"; - platform = platforms.powernv; }; sheevaplug = { config = "armv5tel-unknown-linux-gnueabi"; - platform = platforms.sheevaplug; - }; + } // platforms.sheevaplug; raspberryPi = { config = "armv6l-unknown-linux-gnueabihf"; - platform = platforms.raspberrypi; - }; + } // platforms.raspberrypi; remarkable1 = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.zero-gravitas; - }; + } // platforms.zero-gravitas; remarkable2 = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.zero-sugar; - }; + } // platforms.zero-sugar; armv7l-hf-multiplatform = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.armv7l-hf-multiplatform; }; aarch64-multiplatform = { config = "aarch64-unknown-linux-gnu"; - platform = platforms.aarch64-multiplatform; }; armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; sdkVer = "29"; ndkVer = "21"; - platform = platforms.armv7a-android; useAndroidPrebuilt = true; - }; + } // platforms.armv7a-android; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; sdkVer = "29"; ndkVer = "21"; - platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; - scaleway-c1 = armv7l-hf-multiplatform // rec { - platform = platforms.scaleway-c1; - inherit (platform.gcc) fpu; - }; + scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1; pogoplug4 = { config = "armv5tel-unknown-linux-gnueabi"; - platform = platforms.pogoplug4; - }; + } // platforms.pogoplug4; ben-nanonote = { config = "mipsel-unknown-linux-uclibc"; - platform = platforms.ben_nanonote; - }; + } // platforms.ben_nanonote; fuloongminipc = { config = "mipsel-unknown-linux-gnu"; - platform = platforms.fuloong2f_n32; - }; + } // platforms.fuloong2f_n32; muslpi = raspberryPi // { config = "armv6l-unknown-linux-musleabihf"; }; - aarch64-multiplatform-musl = aarch64-multiplatform // { + aarch64-multiplatform-musl = { config = "aarch64-unknown-linux-musl"; }; @@ -110,13 +93,11 @@ rec { riscv64-embedded = { config = "riscv64-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform; }; riscv32-embedded = { config = "riscv32-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform; }; mmix = { @@ -136,13 +117,11 @@ rec { vc4 = { config = "vc4-elf"; libc = "newlib"; - platform = {}; }; or1k = { config = "or1k-elf"; libc = "newlib"; - platform = {}; }; arm-embedded = { @@ -204,7 +183,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; - platform = {}; }; iphone32 = { @@ -214,7 +192,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; - platform = {}; }; iphone64-simulator = { @@ -224,7 +201,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; - platform = {}; }; iphone32-simulator = { @@ -234,7 +210,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; - platform = {}; }; # @@ -245,7 +220,6 @@ rec { mingw32 = { config = "i686-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain - platform = {}; }; # 64 bit mingw-w64 @@ -253,7 +227,6 @@ rec { # That's the triplet they use in the mingw-w64 docs. config = "x86_64-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain - platform = {}; }; # BSDs @@ -275,6 +248,5 @@ rec { # Ghcjs ghcjs = { config = "js-unknown-ghcjs"; - platform = {}; }; } diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index e869de488c1..f399c1873f5 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -1,39 +1,36 @@ { lib }: rec { - pcBase = { - name = "pc"; - kernelBaseConfig = "defconfig"; - # Build whatever possible as a module, if not stated in the extra config. - kernelAutoModules = true; - kernelTarget = "bzImage"; - }; - - pc64 = pcBase // { kernelArch = "x86_64"; }; - - pc32 = pcBase // { kernelArch = "i386"; }; - - pc32_simplekernel = pc32 // { - kernelAutoModules = false; + pc = { + linux-kernel = { + name = "pc"; + + baseConfig = "defconfig"; + # Build whatever possible as a module, if not stated in the extra config. + autoModules = true; + target = "bzImage"; + }; }; - pc64_simplekernel = pc64 // { - kernelAutoModules = false; + pc_simplekernel = lib.recursiveUpdate pc { + linux-kernel.autoModules = false; }; powernv = { - name = "PowerNV"; - kernelArch = "powerpc"; - kernelBaseConfig = "powernv_defconfig"; - kernelTarget = "zImage"; - kernelInstallTarget = "install"; - kernelFile = "vmlinux"; - kernelAutoModules = true; - # avoid driver/FS trouble arising from unusual page size - kernelExtraConfig = '' - PPC_64K_PAGES n - PPC_4K_PAGES y - IPV6 y - ''; + linux-kernel = { + name = "PowerNV"; + + baseConfig = "powernv_defconfig"; + target = "zImage"; + installTarget = "install"; + file = "vmlinux"; + autoModules = true; + # avoid driver/FS trouble arising from unusual page size + extraConfig = '' + PPC_64K_PAGES n + PPC_4K_PAGES y + IPV6 y + ''; + }; }; ## @@ -41,17 +38,121 @@ rec { ## pogoplug4 = { - name = "pogoplug4"; + linux-kernel = { + name = "pogoplug4"; + baseConfig = "multi_v5_defconfig"; + autoModules = false; + extraConfig = '' + # Ubi for the mtd + MTD_UBI y + UBIFS_FS y + UBIFS_FS_XATTR y + UBIFS_FS_ADVANCED_COMPR y + UBIFS_FS_LZO y + UBIFS_FS_ZLIB y + UBIFS_FS_DEBUG n + ''; + makeFlags = [ "LOADADDR=0x8000" ]; + target = "uImage"; + # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working + #DTB = true; + }; gcc = { arch = "armv5te"; }; + }; + + sheevaplug = { + linux-kernel = { + name = "sheevaplug"; + + baseConfig = "multi_v5_defconfig"; + autoModules = false; + extraConfig = '' + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + BTRFS_FS m + XFS_FS m + JFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + # mv cesa requires this sw fallback, for mv-sha1 + CRYPTO_SHA1 y + # Fast crypto + CRYPTO_TWOFISH y + CRYPTO_TWOFISH_COMMON y + CRYPTO_BLOWFISH y + CRYPTO_BLOWFISH_COMMON y + + IP_PNP y + IP_PNP_DHCP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + NETFILTER y + IP_NF_IPTABLES y + IP_NF_FILTER y + IP_NF_MATCH_ADDRTYPE y + IP_NF_TARGET_LOG y + IP_NF_MANGLE y + IPV6 m + VLAN_8021Q m + + CIFS y + CIFS_XATTR y + CIFS_POSIX y + CIFS_FSCACHE y + CIFS_ACL y + + WATCHDOG y + WATCHDOG_CORE y + ORION_WATCHDOG m + + ZRAM m + NETCONSOLE m + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # systemd uses cgroups + CGROUPS y + + # Latencytop + LATENCYTOP y - kernelBaseConfig = "multi_v5_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = - '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -60,137 +161,36 @@ rec { UBIFS_FS_LZO y UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n - ''; - kernelMakeFlags = [ "LOADADDR=0x8000" ]; - kernelTarget = "uImage"; - # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working - #kernelDTB = true; - }; - sheevaplug = { - name = "sheevaplug"; - kernelBaseConfig = "multi_v5_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = '' - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - BTRFS_FS m - XFS_FS m - JFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - # mv cesa requires this sw fallback, for mv-sha1 - CRYPTO_SHA1 y - # Fast crypto - CRYPTO_TWOFISH y - CRYPTO_TWOFISH_COMMON y - CRYPTO_BLOWFISH y - CRYPTO_BLOWFISH_COMMON y - - IP_PNP y - IP_PNP_DHCP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - NETFILTER y - IP_NF_IPTABLES y - IP_NF_FILTER y - IP_NF_MATCH_ADDRTYPE y - IP_NF_TARGET_LOG y - IP_NF_MANGLE y - IPV6 m - VLAN_8021Q m - - CIFS y - CIFS_XATTR y - CIFS_POSIX y - CIFS_FSCACHE y - CIFS_ACL y - - WATCHDOG y - WATCHDOG_CORE y - ORION_WATCHDOG m - - ZRAM m - NETCONSOLE m - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # systemd uses cgroups - CGROUPS y - - # Latencytop - LATENCYTOP y - - # Ubi for the mtd - MTD_UBI y - UBIFS_FS y - UBIFS_FS_XATTR y - UBIFS_FS_ADVANCED_COMPR y - UBIFS_FS_LZO y - UBIFS_FS_ZLIB y - UBIFS_FS_DEBUG n - - # Kdb, for kernel troubles - KGDB y - KGDB_SERIAL_CONSOLE y - KGDB_KDB y - ''; - kernelMakeFlags = [ "LOADADDR=0x0200000" ]; - kernelTarget = "uImage"; - kernelDTB = true; # Beyond 3.10 + # Kdb, for kernel troubles + KGDB y + KGDB_SERIAL_CONSOLE y + KGDB_KDB y + ''; + makeFlags = [ "LOADADDR=0x0200000" ]; + target = "uImage"; + DTB = true; # Beyond 3.10 + }; gcc = { arch = "armv5te"; }; }; raspberrypi = { - name = "raspberrypi"; - kernelBaseConfig = "bcm2835_defconfig"; - kernelDTB = true; - kernelArch = "arm"; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelExtraConfig = '' - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; - kernelTarget = "zImage"; + linux-kernel = { + name = "raspberrypi"; + + baseConfig = "bcm2835_defconfig"; + DTB = true; + autoModules = true; + preferBuiltin = true; + extraConfig = '' + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; + target = "zImage"; + }; gcc = { arch = "armv6"; fpu = "vfp"; @@ -201,13 +201,15 @@ rec { raspberrypi2 = armv7l-hf-multiplatform; zero-gravitas = { - name = "zero-gravitas"; - kernelBaseConfig = "zero-gravitas_defconfig"; - kernelArch = "arm"; - # kernelTarget verified by checking /boot on reMarkable 1 device - kernelTarget = "zImage"; - kernelAutoModules = false; - kernelDTB = true; + linux-kernel = { + name = "zero-gravitas"; + + baseConfig = "zero-gravitas_defconfig"; + # Target verified by checking /boot on reMarkable 1 device + target = "zImage"; + autoModules = false; + DTB = true; + }; gcc = { fpu = "neon"; cpu = "cortex-a9"; @@ -215,13 +217,15 @@ rec { }; zero-sugar = { - name = "zero-sugar"; - kernelBaseConfig = "zero-sugar_defconfig"; - kernelArch = "arm"; - kernelDTB = true; - kernelAutoModules = false; - kernelPreferBuiltin = true; - kernelTarget = "zImage"; + linux-kernel = { + name = "zero-sugar"; + + baseConfig = "zero-sugar_defconfig"; + DTB = true; + autoModules = false; + preferBuiltin = true; + target = "zImage"; + }; gcc = { cpu = "cortex-a7"; fpu = "neon-vfpv4"; @@ -229,7 +233,7 @@ rec { }; }; - scaleway-c1 = armv7l-hf-multiplatform // { + scaleway-c1 = lib.recursiveUpdate armv7l-hf-multiplatform { gcc = { cpu = "cortex-a9"; fpu = "vfpv3"; @@ -237,12 +241,11 @@ rec { }; utilite = { - name = "utilite"; - kernelBaseConfig = "multi_v7_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = - '' + linux-kernel = { + name = "utilite"; + maseConfig = "multi_v7_defconfig"; + autoModules = false; + extraConfig = '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -252,35 +255,37 @@ rec { UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n ''; - kernelMakeFlags = [ "LOADADDR=0x10800000" ]; - kernelTarget = "uImage"; - kernelDTB = true; + makeFlags = [ "LOADADDR=0x10800000" ]; + target = "uImage"; + DTB = true; + }; gcc = { cpu = "cortex-a9"; fpu = "neon"; }; }; - guruplug = sheevaplug // { + guruplug = lib.recursiveUpdate sheevaplug { # Define `CONFIG_MACH_GURUPLUG' (see # ) # and other GuruPlug-specific things. Requires the `guruplug-defconfig' # patch. - - kernelBaseConfig = "guruplug_defconfig"; + linux-kernel.baseConfig = "guruplug_defconfig"; }; - beaglebone = armv7l-hf-multiplatform // { - name = "beaglebone"; - kernelBaseConfig = "bb.org_defconfig"; - kernelAutoModules = false; - kernelExtraConfig = ""; # TBD kernel config - kernelTarget = "zImage"; + beaglebone = lib.recursiveUpdate armv7l-hf-multiplatform { + linux-kernel = { + name = "beaglebone"; + baseConfig = "bb.org_defconfig"; + autoModules = false; + extraConfig = ""; # TBD kernel config + target = "zImage"; + }; }; # https://developer.android.com/ndk/guides/abis#v7a - armv7a-android = { - name = "armeabi-v7a"; + armv7a-android = { + linux-kernel.name = "armeabi-v7a"; gcc = { arch = "armv7-a"; float-abi = "softfp"; @@ -289,29 +294,31 @@ rec { }; armv7l-hf-multiplatform = { - name = "armv7l-hf-multiplatform"; - kernelBaseConfig = "multi_v7_defconfig"; - kernelArch = "arm"; - kernelDTB = true; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelTarget = "zImage"; - kernelExtraConfig = '' - # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Fix broken sunxi-sid nvmem driver. - TI_CPTS y - - # Hangs ODROID-XU4 - ARM_BIG_LITTLE_CPUIDLE n - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; + linux-kernel = { + name = "armv7l-hf-multiplatform"; + Major = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc. + baseConfig = "multi_v7_defconfig"; + DTB = true; + autoModules = true; + PreferBuiltin = true; + target = "zImage"; + extraConfig = '' + # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Fix broken sunxi-sid nvmem driver. + TI_CPTS y + + # Hangs ODROID-XU4 + ARM_BIG_LITTLE_CPUIDLE n + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; + }; gcc = { # Some table about fpu flags: # http://community.arm.com/servlet/JiveServlet/showImage/38-1981-3827/blogentry-103749-004812900+1365712953_thumb.png @@ -336,34 +343,35 @@ rec { }; aarch64-multiplatform = { - name = "aarch64-multiplatform"; - kernelBaseConfig = "defconfig"; - kernelArch = "arm64"; - kernelDTB = true; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelExtraConfig = '' - # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10. - ARCH_BCM2835 y - BCM2835_MBOX y - BCM2835_WDT y - RASPBERRYPI_FIRMWARE y - RASPBERRYPI_POWER y - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Cavium ThunderX stuff. - PCI_HOST_THUNDER_ECAM y - - # Nvidia Tegra stuff. - PCI_TEGRA y - - # The default (=y) forces us to have the XHCI firmware available in initrd, - # which our initrd builder can't currently do easily. - USB_XHCI_TEGRA m - ''; - kernelTarget = "Image"; + linux-kernel = { + name = "aarch64-multiplatform"; + baseConfig = "defconfig"; + DTB = true; + autoModules = true; + preferBuiltin = true; + extraConfig = '' + # Raspberry Pi 3 stuff. Not needed for s >= 4.10. + ARCH_BCM2835 y + BCM2835_MBOX y + BCM2835_WDT y + RASPBERRYPI_FIRMWARE y + RASPBERRYPI_POWER y + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Cavium ThunderX stuff. + PCI_HOST_THUNDER_ECAM y + + # Nvidia Tegra stuff. + PCI_TEGRA y + + # The default (=y) forces us to have the XHCI firmware available in initrd, + # which our initrd builder can't currently do easily. + USB_XHCI_TEGRA m + ''; + target = "Image"; + }; gcc = { arch = "armv8-a"; }; @@ -374,8 +382,9 @@ rec { ## ben_nanonote = { - name = "ben_nanonote"; - kernelArch = "mips"; + linux-kernel = { + name = "ben_nanonote"; + }; gcc = { arch = "mips32"; float = "soft"; @@ -383,75 +392,76 @@ rec { }; fuloong2f_n32 = { - name = "fuloong2f_n32"; - kernelBaseConfig = "lemote2f_defconfig"; - kernelArch = "mips"; - kernelAutoModules = false; - kernelExtraConfig = '' - MIGRATION n - COMPACTION n - - # nixos mounts some cgroup - CGROUPS y - - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - IP_PNP y - IP_PNP_DHCP y - IP_PNP_BOOTP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # Needed for udev >= 150 - SYSFS_DEPRECATED_V2 n - - VGA_CONSOLE n - VT_HW_CONSOLE_BINDING y - SERIAL_8250_CONSOLE y - FRAMEBUFFER_CONSOLE y - EXT2_FS y - EXT3_FS y - REISERFS_FS y - MAGIC_SYSRQ y - - # The kernel doesn't boot at all, with FTRACE - FTRACE n - ''; - kernelTarget = "vmlinux"; + linux-kernel = { + name = "fuloong2f_n32"; + baseConfig = "lemote2f_defconfig"; + autoModules = false; + extraConfig = '' + MIGRATION n + COMPACTION n + + # nixos mounts some cgroup + CGROUPS y + + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + IP_PNP y + IP_PNP_DHCP y + IP_PNP_BOOTP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # Needed for udev >= 150 + SYSFS_DEPRECATED_V2 n + + VGA_CONSOLE n + VT_HW_CONSOLE_BINDING y + SERIAL_8250_CONSOLE y + FRAMEBUFFER_CONSOLE y + EXT2_FS y + EXT3_FS y + REISERFS_FS y + MAGIC_SYSRQ y + + # The kernel doesn't boot at all, with FTRACE + FTRACE n + ''; + target = "vmlinux"; + }; gcc = { arch = "loongson2f"; float = "hard"; @@ -464,34 +474,36 @@ rec { ## riscv-multiplatform = { - name = "riscv-multiplatform"; - kernelArch = "riscv"; - kernelTarget = "vmlinux"; - kernelAutoModules = true; - kernelBaseConfig = "defconfig"; - kernelExtraConfig = '' - FTRACE n - SERIAL_OF_PLATFORM y - ''; + linux-kernel = { + name = "riscv-multiplatform"; + target = "vmlinux"; + autoModules = true; + baseConfig = "defconfig"; + extraConfig = '' + FTRACE n + SERIAL_OF_PLATFORM y + ''; + }; }; select = platform: # x86 - /**/ if platform.isx86_32 then pc32 - else if platform.isx86_64 then pc64 + /**/ if platform.isx86 then pc # ARM else if platform.isAarch32 then let version = platform.parsed.cpu.version or null; - in if version == null then pcBase + in if version == null then pc else if lib.versionOlder version "6" then sheevaplug else if lib.versionOlder version "7" then raspberrypi else armv7l-hf-multiplatform else if platform.isAarch64 then aarch64-multiplatform + else if platform.isRiscV then riscv-multiplatform + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv - else pcBase; + else pc; } diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml index e46d1ca403f..408c896defe 100644 --- a/nixos/doc/manual/release-notes/rl-2103.xml +++ b/nixos/doc/manual/release-notes/rl-2103.xml @@ -592,6 +592,22 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e /etc/netgroup defines network-wide groups and may affect to setups using NIS. + + + Platforms, like stdenv.hostPlatform, no longer have a platform attribute. + It has been (mostly) flattoned away: + + + platform.gcc is now gcc + platform.kernel* is now linux-kernel.* + + + Additionally, platform.kernelArch moved to the top level as linuxArch to match the other *Arch variables. + + + The platform grouping of these things never meant anything, and was just a historial/implementation artifact that was overdue removal. + + diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index e0ab37bca63..4aa1d6369d1 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -68,11 +68,11 @@ let patchShebangs scripts/* substituteInPlace scripts/Makefile.lib \ --replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@' - make ${pkgs.stdenv.hostPlatform.platform.kernelBaseConfig} ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" - make dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" + make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" + make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" ''; installPhase = '' - make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" + make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" ''; }; @@ -115,7 +115,7 @@ in options = { hardware.deviceTree = { enable = mkOption { - default = pkgs.stdenv.hostPlatform.platform.kernelDTB or false; + default = pkgs.stdenv.hostPlatform.linux-kernel.DTB or false; type = types.bool; description = '' Build device tree files. These are used to describe the diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix index 95eba86bcb6..fa074fdfcc6 100644 --- a/nixos/modules/installer/netboot/netboot.nix +++ b/nixos/modules/installer/netboot/netboot.nix @@ -88,7 +88,7 @@ with lib; system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' #!ipxe - kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} + kernel ${pkgs.stdenv.hostPlatform.linux-kernel.target} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} initrd initrd boot ''; diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 0eeff31d6c4..64bdbf159d5 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -587,10 +587,10 @@ in nix.systemFeatures = mkDefault ( [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ - optionals (pkgs.hostPlatform.platform ? gcc.arch) ( - # a builder can run code for `platform.gcc.arch` and inferior architectures - [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ - map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch} + optionals (pkgs.hostPlatform ? gcc.arch) ( + # a builder can run code for `gcc.arch` and inferior architectures + [ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++ + map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch} ) ); diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 03d7e749323..b0f77ca3fb8 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -190,7 +190,7 @@ in system.boot.loader.kernelFile = mkOption { internal = true; - default = pkgs.stdenv.hostPlatform.platform.kernelTarget; + default = pkgs.stdenv.hostPlatform.linux-kernel.target; type = types.str; description = '' Name of the kernel file to be passed to the bootloader. diff --git a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix index 2d27611946e..fee567a510b 100644 --- a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix +++ b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix @@ -59,7 +59,7 @@ in system.build.installBootLoader = generationsDirBuilder; system.boot.loader.id = "generationsDir"; - system.boot.loader.kernelFile = platform.kernelTarget; + system.boot.loader.kernelFile = linux-kernel.target; }; } diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix index ba936b26573..db22dd36cbe 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix @@ -103,6 +103,6 @@ in system.build.installBootLoader = builder; system.boot.loader.id = "raspberrypi"; - system.boot.loader.kernelFile = platform.kernelTarget; + system.boot.loader.kernelFile = linux-kernel.target; }; } diff --git a/nixos/release.nix b/nixos/release.nix index 1f5c1581269..109747945f7 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -79,7 +79,7 @@ let in tarball // { meta = { - description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.platform.name}"; + description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}"; maintainers = map (x: lib.maintainers.${x}) maintainers; }; inherit config; @@ -105,7 +105,7 @@ let modules = makeModules module {}; }; build = configEvaled.config.system.build; - kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.platform.kernelTarget; + kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target; in pkgs.symlinkJoin { name = "netboot"; diff --git a/pkgs/applications/audio/virtual-ans/default.nix b/pkgs/applications/audio/virtual-ans/default.nix index dd7e8b062da..1cb9c0f18bf 100644 --- a/pkgs/applications/audio/virtual-ans/default.nix +++ b/pkgs/applications/audio/virtual-ans/default.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { startScript = if stdenv.isx86_32 then "START_LINUX_X86" else if stdenv.isx86_64 then "START_LINUX_X86_64" #else if stdenv.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin - else abort "Unsupported platform: ${stdenv.platform.kernelArch}."; + else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; linuxExecutable = if stdenv.isx86_32 then "pixilang_linux_x86" else if stdenv.isx86_64 then "pixilang_linux_x86_64" diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix index 3ad540e5307..848b93a5381 100644 --- a/pkgs/applications/virtualization/crosvm/default.nix +++ b/pkgs/applications/virtualization/crosvm/default.nix @@ -75,7 +75,7 @@ in CROSVM_CARGO_TEST_KERNEL_BINARY = lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) - "${linux}/${stdenv.hostPlatform.platform.kernelTarget}"; + "${linux}/${stdenv.hostPlatform.linux-kernel.target}"; passthru = { inherit adhdSrc; diff --git a/pkgs/applications/virtualization/vpcs/default.nix b/pkgs/applications/virtualization/vpcs/default.nix index 33d707a5007..8c41a1f4c27 100644 --- a/pkgs/applications/virtualization/vpcs/default.nix +++ b/pkgs/applications/virtualization/vpcs/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { buildPhase = ''( cd src - ./mk.sh ${stdenv.buildPlatform.platform.kernelArch} + ./mk.sh ${stdenv.buildPlatform.linuxArch} )''; installPhase = '' diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index bd3ebdf800e..e0d43739668 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -190,7 +190,7 @@ stdenv.mkDerivation { else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" - else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); + else targetPlatform.bfdEmulation or (fmt + sep + arch); strictDeps = true; depsTargetTargetPropagated = extraPackages; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d1d5f8e6c86..faa62cb5b12 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -403,31 +403,31 @@ stdenv.mkDerivation { # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in # that case. + optionalString ((targetPlatform ? platform.gcc.arch) && - isGccArchSupported targetPlatform.platform.gcc.arch) '' - echo "-march=${targetPlatform.platform.gcc.arch}" >> $out/nix-support/cc-cflags-before + isGccArchSupported targetPlatform.gcc.arch) '' + echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' # -mcpu is not very useful. You should use mtune and march # instead. It’s provided here for backwards compatibility. + optionalString (targetPlatform ? platform.gcc.cpu) '' - echo "-mcpu=${targetPlatform.platform.gcc.cpu}" >> $out/nix-support/cc-cflags-before + echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before '' # -mfloat-abi only matters on arm32 but we set it here # unconditionally just in case. If the abi specifically sets hard # vs. soft floats we use it here. + optionalString (targetPlatform ? platform.gcc.float-abi) '' - echo "-mfloat-abi=${targetPlatform.platform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before + echo "-mfloat-abi=${targetPlatform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.fpu) '' - echo "-mfpu=${targetPlatform.platform.gcc.fpu}" >> $out/nix-support/cc-cflags-before + echo "-mfpu=${targetPlatform.gcc.fpu}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.mode) '' - echo "-mmode=${targetPlatform.platform.gcc.mode}" >> $out/nix-support/cc-cflags-before + echo "-mmode=${targetPlatform.gcc.mode}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.tune && - isGccArchSupported targetPlatform.platform.gcc.tune) '' - echo "-mtune=${targetPlatform.platform.gcc.tune}" >> $out/nix-support/cc-cflags-before + isGccArchSupported targetPlatform.gcc.tune) '' + echo "-mtune=${targetPlatform.gcc.tune}" >> $out/nix-support/cc-cflags-before '' # TODO: categorize these and figure out a better place for them diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix index 901eb311a88..9af40d33242 100644 --- a/pkgs/build-support/kernel/make-initrd.nix +++ b/pkgs/build-support/kernel/make-initrd.nix @@ -56,13 +56,13 @@ in , prepend ? [] # Whether to wrap the initramfs in a u-boot image. -, makeUInitrd ? stdenvNoCC.hostPlatform.platform.kernelTarget == "uImage" +, makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target == "uImage" # If generating a u-boot image, the architecture to use. The default # guess may not align with u-boot's nomenclature correctly, so it can # be overridden. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list. -, uInitrdArch ? stdenvNoCC.hostPlatform.kernelArch +, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch # The name of the compression, as recognised by u-boot. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list. diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 5f3c7e1d621..215782368f6 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -1,6 +1,6 @@ { pkgs , kernel ? pkgs.linux -, img ? pkgs.stdenv.hostPlatform.platform.kernelTarget +, img ? pkgs.stdenv.hostPlatform.linux-kernel.target , storeDir ? builtins.storeDir , rootModules ? [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" ] diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index f3cdce41193..66af8c4a4cc 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -1,7 +1,7 @@ { lib, targetPlatform }: let - p = targetPlatform.platform.gcc or {} + p = targetPlatform.gcc or {} // targetPlatform.parsed.abi; in lib.concatLists [ (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64 diff --git a/pkgs/development/compilers/julia/1.0.nix b/pkgs/development/compilers/julia/1.0.nix index 0325632ad0a..78f7c2ef1b9 100644 --- a/pkgs/development/compilers/julia/1.0.nix +++ b/pkgs/development/compilers/julia/1.0.nix @@ -123,7 +123,7 @@ stdenv.mkDerivation rec { let arch = stdenv.lib.head (stdenv.lib.splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.3.nix b/pkgs/development/compilers/julia/1.3.nix index 8096af0b320..2a270b7c72c 100644 --- a/pkgs/development/compilers/julia/1.3.nix +++ b/pkgs/development/compilers/julia/1.3.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.5.nix b/pkgs/development/compilers/julia/1.5.nix index be3cfc39635..778a9c3a9d7 100644 --- a/pkgs/development/compilers/julia/1.5.nix +++ b/pkgs/development/compilers/julia/1.5.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 6b17e463d76..6637a9bb2a3 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -158,7 +158,7 @@ stdenv.mkDerivation ({ "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ (lib.flip lib.withFeature "fp" - (stdenv.hostPlatform.platform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) + (stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) "--with-__thread" ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [ "--host=arm-linux-gnueabi" diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index e6ab23073b1..1a3f1948f84 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix @@ -88,7 +88,7 @@ qtModule { NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit "-Wno-class-memaccess" - ] ++ lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [ + ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [ # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940 # TODO: investigate and fix properly "-march=westmere" diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix index e333bd49718..edf556377b3 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix @@ -73,9 +73,9 @@ let if isLinux then ( - x: x.platform == "manylinux1_${stdenv.platform.kernelArch}" - || x.platform == "manylinux2010_${stdenv.platform.kernelArch}" - || x.platform == "manylinux2014_${stdenv.platform.kernelArch}" + x: x.platform == "manylinux1_${stdenv.hostPlatform.linuxArch}" + || x.platform == "manylinux2010_${stdenv.hostPlatform.linuxArch}" + || x.platform == "manylinux2014_${stdenv.hostPlatform.linuxArch}" || x.platform == "any" ) else (x: hasInfix "macosx" x.platform || x.platform == "any"); diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix index ba8145398f5..ea2f27b0e22 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix @@ -95,7 +95,7 @@ let else if stdenv.isDarwin then "darwin" else throw "Unsupported platform" ); - platform_machine = stdenv.platform.kernelArch; + platform_machine = stdenv.hostPlatform.linuxArch; platform_python_implementation = let impl = python.passthru.implementation; diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index 5308149c26b..ccea8ee4553 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -60,18 +60,17 @@ in configureFlags = let isCross = stdenv.hostPlatform != stdenv.buildPlatform; - host = stdenv.hostPlatform.platform; - isAarch32 = stdenv.hostPlatform.isAarch32; + inherit (stdenv.hostPlatform) gcc isArch32; in sharedConfigureFlags ++ [ "--without-dtrace" ] ++ (optionals isCross [ "--cross-compiling" "--without-intl" "--without-snapshot" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" host.gcc) [ - "--with-arm-fpu=${host.gcc.fpu}" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" host.gcc) [ - "--with-arm-float-abi=${host.gcc.float-abi}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [ + "--with-arm-fpu=${gcc.fpu}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [ + "--with-arm-float-abi=${gcc.float-abi}" ]) ++ (optionals (isCross && isAarch32) [ "--dest-cpu=arm" ]) ++ extraConfigFlags; diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix index 88792346d70..958bcdb9f16 100644 --- a/pkgs/os-specific/linux/exfat/default.nix +++ b/pkgs/os-specific/linux/exfat/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { makeFlags = [ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index cadf65a7220..d6ed7bccba3 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -7,7 +7,7 @@ let pname = "linux-headers"; inherit version; - ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch; + ARCH = stdenvNoCC.hostPlatform.linuxArch; # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc. # We do this so we have a build->build, not build->host, C compiler. diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 31a90dc740f..ac9d6fbb2b5 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -42,7 +42,7 @@ # symbolic name and `patch' is the actual patch. The patch may # optionally be compressed with gzip or bzip2. kernelPatches ? [] -, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" || +, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc" || stdenv.hostPlatform != stdenv.buildPlatform , extraMeta ? {} @@ -51,10 +51,10 @@ , isLibre ? false , isHardened ? false -# easy overrides to stdenv.hostPlatform.platform members -, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules -, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false -, kernelArch ? stdenv.hostPlatform.platform.kernelArch +# easy overrides to stdenv.hostPlatform.linux-kernel members +, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules +, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false +, kernelArch ? stdenv.hostPlatform.linuxArch , ... }: @@ -87,7 +87,7 @@ let intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig # extra config in legacy string format + extraConfig - + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig; + + stdenv.hostPlatform.linux-kernel.extraConfig or ""; structuredConfigFromPatches = map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches; @@ -113,11 +113,11 @@ let nativeBuildInputs = [ perl gmp libmpc mpfr ] ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ]; - platformName = stdenv.hostPlatform.platform.name; + platformName = stdenv.hostPlatform.linux-kernel.name; # e.g. "defconfig" - kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig; + kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig; # e.g. "bzImage" - kernelTarget = stdenv.hostPlatform.platform.kernelTarget; + kernelTarget = stdenv.hostPlatform.linux-kernel.target; prePatch = kernel.prePatch + '' # Patch kconfig to print "###" after every question so that diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 67016b71918..2fc63322f5b 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -64,10 +64,10 @@ let commonMakeFlags = [ "O=$(buildRoot)" - ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags) - stdenv.hostPlatform.platform.kernelMakeFlags; + ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags) + stdenv.hostPlatform.linux-kernel.makeFlags; - drvAttrs = config_: platform: kernelPatches: configfile: + drvAttrs = config_: kernelConf: kernelPatches: configfile: let config = let attrName = attr: "CONFIG_" + attr; in { isSet = attr: hasAttr (attrName attr) config; @@ -171,7 +171,7 @@ let buildFlags = [ "KBUILD_BUILD_VERSION=1-NixOS" - platform.kernelTarget + kernelConf.target "vmlinux" # for "perf" and things like that ] ++ optional isModular "modules"; @@ -186,16 +186,16 @@ let ''; # Some image types need special install targets (e.g. uImage is installed with make uinstall) - installTargets = [ ( - if platform ? kernelInstallTarget then platform.kernelInstallTarget - else if platform.kernelTarget == "uImage" then "uinstall" - else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall" - else "install" - ) ]; + installTargets = [ + (kernelConf.installTarget or ( + /**/ if kernelConf.target == "uImage" then "uinstall" + else if kernelConf.target == "zImage" || kernelConf.target == "Image.gz" then "zinstall" + else "install")) + ]; postInstall = (optionalString installsFirmware '' mkdir -p $out/lib/firmware - '') + (if (platform ? kernelDTB && platform.kernelDTB) then '' + '') + (if (kernelConf.DTB or false) then '' make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs '' else "") + (if isModular then '' mkdir -p $dev @@ -300,7 +300,7 @@ in assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null; assert lib.versionAtLeast version "5.8" -> elfutils != null; -stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // { +stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // { pname = "linux"; inherit version; @@ -308,7 +308,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ] - ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools + ++ optional (stdenv.hostPlatform.linux-kernel.target == "uImage") buildPackages.ubootTools ++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf # Removed util-linuxMinimal since it should not be a dependency. ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ] @@ -322,10 +322,10 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches makeFlags = commonMakeFlags ++ [ "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; - karch = stdenv.hostPlatform.platform.kernelArch; + karch = stdenv.hostPlatform.linuxArch; }) diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix index 65ab71bd562..dc96f3b6a62 100644 --- a/pkgs/os-specific/linux/klibc/default.nix +++ b/pkgs/os-specific/linux/klibc/default.nix @@ -25,11 +25,11 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" "stackprotector" ]; makeFlags = commonMakeFlags ++ [ - "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}" + "KLIBCARCH=${stdenv.hostPlatform.linuxArch}" "KLIBCKERNELSRC=${linuxHeaders}" ] # TODO(@Ericson2314): We now can get the ABI from # `stdenv.hostPlatform.parsed.abi`, is this still a good idea? - ++ lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y" + ++ lib.optional (stdenv.hostPlatform.linuxArch == "arm") "CONFIG_AEABI=y" ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}"; # Install static binaries as well. diff --git a/pkgs/os-specific/linux/rtl8723bs/default.nix b/pkgs/os-specific/linux/rtl8723bs/default.nix index 056fd40d252..a862b351716 100644 --- a/pkgs/os-specific/linux/rtl8723bs/default.nix +++ b/pkgs/os-specific/linux/rtl8723bs/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { buildInputs = [ nukeReferences ]; makeFlags = [ - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. + "ARCH=${stdenv.hostPlatform.linuxArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us. ]; diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix index aeed87d3c19..68a88fb6778 100644 --- a/pkgs/os-specific/linux/rtl8812au/default.nix +++ b/pkgs/os-specific/linux/rtl8812au/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { ''; makeFlags = [ - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n")) ("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n")) diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix index 7c95a98372d..7508e1faf15 100644 --- a/pkgs/os-specific/linux/uclibc/default.nix +++ b/pkgs/os-specific/linux/uclibc/default.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation { cat << EOF | parseconfig ${nixConfig} ${extraConfig} - ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""} + ${stdenv.hostPlatform.uclibc.extraConfig or ""} EOF ( set +o pipefail; yes "" | make oldconfig ) ''; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 0eb799e4525..e8ccd02c041 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -279,7 +279,7 @@ in rec { } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? platform.gcc.arch) { - requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.platform.gcc.arch}" ]; + requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ]; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { inherit __darwinAllowLocalNetworking; # TODO: remove lib.unique once nix has a list canonicalization primitive diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5985483c4ed..5db97df7b29 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19284,7 +19284,7 @@ in buildPhase = '' set -x make \ - ARCH=${stdenv.hostPlatform.kernelArch} \ + ARCH=${stdenv.hostPlatform.linuxArch} \ HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \ ${makeTarget} ''; -- cgit 1.4.1 From 0bc275e63423456d6deb650e146120c39c1e0723 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Fri, 22 Jan 2021 14:07:06 -0800 Subject: Revert "lib: Clean up how linux and gcc config is specified" This is a stdenv-rebuild, and should not be merged into master This reverts commit 8929989614589ee3acd070a6409b2b9700c92d65. --- lib/systems/default.nix | 13 +- lib/systems/examples.nix | 48 +- lib/systems/platforms.nix | 670 ++++++++++----------- nixos/doc/manual/release-notes/rl-2103.xml | 16 - nixos/modules/hardware/device-tree.nix | 8 +- nixos/modules/installer/netboot/netboot.nix | 2 +- nixos/modules/services/misc/nix-daemon.nix | 8 +- nixos/modules/system/activation/top-level.nix | 2 +- .../loader/generations-dir/generations-dir.nix | 2 +- .../system/boot/loader/raspberrypi/raspberrypi.nix | 2 +- nixos/release.nix | 4 +- pkgs/applications/audio/virtual-ans/default.nix | 2 +- .../applications/virtualization/crosvm/default.nix | 2 +- pkgs/applications/virtualization/vpcs/default.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 2 +- pkgs/build-support/cc-wrapper/default.nix | 16 +- pkgs/build-support/kernel/make-initrd.nix | 4 +- pkgs/build-support/vm/default.nix | 2 +- .../compilers/gcc/common/platform-flags.nix | 2 +- pkgs/development/compilers/julia/1.0.nix | 2 +- pkgs/development/compilers/julia/1.3.nix | 2 +- pkgs/development/compilers/julia/1.5.nix | 2 +- pkgs/development/libraries/glibc/common.nix | 2 +- .../libraries/qt-5/modules/qtwebengine.nix | 2 +- .../tools/poetry2nix/poetry2nix/pep425.nix | 6 +- .../tools/poetry2nix/poetry2nix/pep508.nix | 2 +- pkgs/development/web/nodejs/nodejs.nix | 11 +- pkgs/os-specific/linux/exfat/default.nix | 2 +- pkgs/os-specific/linux/kernel-headers/default.nix | 2 +- pkgs/os-specific/linux/kernel/generic.nix | 18 +- pkgs/os-specific/linux/kernel/manual-config.nix | 30 +- pkgs/os-specific/linux/klibc/default.nix | 4 +- pkgs/os-specific/linux/rtl8723bs/default.nix | 2 +- pkgs/os-specific/linux/rtl8812au/default.nix | 2 +- pkgs/os-specific/linux/uclibc/default.nix | 2 +- pkgs/stdenv/generic/make-derivation.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 37 files changed, 448 insertions(+), 454 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 84d0b34805a..4edcbeb36f1 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -24,6 +24,8 @@ rec { # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; + # Just a guess, based on `system` + platform = platforms.select final; # Determine whether we are compatible with the provided CPU isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu; # Derived meta-data @@ -77,16 +79,7 @@ rec { }; isStatic = final.isWasm || final.isRedox; - # Just a guess, based on `system` - inherit - ({ - linux-kernel = args.linux-kernel or {}; - gcc = args.gcc or {}; - rustc = args.rust or {}; - } // platforms.select final) - linux-kernel gcc rustc; - - linuxArch = + kernelArch = if final.isAarch32 then "arm" else if final.isAarch64 then "arm64" else if final.isx86_32 then "x86" diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index de12e0b83c1..16002450f2d 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -7,6 +7,7 @@ let riscv = bits: { config = "riscv${bits}-unknown-linux-gnu"; + platform = platforms.riscv-multiplatform; }; in @@ -16,68 +17,84 @@ rec { # powernv = { config = "powerpc64le-unknown-linux-gnu"; + platform = platforms.powernv; }; musl-power = { config = "powerpc64le-unknown-linux-musl"; + platform = platforms.powernv; }; sheevaplug = { config = "armv5tel-unknown-linux-gnueabi"; - } // platforms.sheevaplug; + platform = platforms.sheevaplug; + }; raspberryPi = { config = "armv6l-unknown-linux-gnueabihf"; - } // platforms.raspberrypi; + platform = platforms.raspberrypi; + }; remarkable1 = { config = "armv7l-unknown-linux-gnueabihf"; - } // platforms.zero-gravitas; + platform = platforms.zero-gravitas; + }; remarkable2 = { config = "armv7l-unknown-linux-gnueabihf"; - } // platforms.zero-sugar; + platform = platforms.zero-sugar; + }; armv7l-hf-multiplatform = { config = "armv7l-unknown-linux-gnueabihf"; + platform = platforms.armv7l-hf-multiplatform; }; aarch64-multiplatform = { config = "aarch64-unknown-linux-gnu"; + platform = platforms.aarch64-multiplatform; }; armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; sdkVer = "29"; ndkVer = "21"; + platform = platforms.armv7a-android; useAndroidPrebuilt = true; - } // platforms.armv7a-android; + }; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; sdkVer = "29"; ndkVer = "21"; + platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; - scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1; + scaleway-c1 = armv7l-hf-multiplatform // rec { + platform = platforms.scaleway-c1; + inherit (platform.gcc) fpu; + }; pogoplug4 = { config = "armv5tel-unknown-linux-gnueabi"; - } // platforms.pogoplug4; + platform = platforms.pogoplug4; + }; ben-nanonote = { config = "mipsel-unknown-linux-uclibc"; - } // platforms.ben_nanonote; + platform = platforms.ben_nanonote; + }; fuloongminipc = { config = "mipsel-unknown-linux-gnu"; - } // platforms.fuloong2f_n32; + platform = platforms.fuloong2f_n32; + }; muslpi = raspberryPi // { config = "armv6l-unknown-linux-musleabihf"; }; - aarch64-multiplatform-musl = { + aarch64-multiplatform-musl = aarch64-multiplatform // { config = "aarch64-unknown-linux-musl"; }; @@ -93,11 +110,13 @@ rec { riscv64-embedded = { config = "riscv64-none-elf"; libc = "newlib"; + platform = platforms.riscv-multiplatform; }; riscv32-embedded = { config = "riscv32-none-elf"; libc = "newlib"; + platform = platforms.riscv-multiplatform; }; mmix = { @@ -117,11 +136,13 @@ rec { vc4 = { config = "vc4-elf"; libc = "newlib"; + platform = {}; }; or1k = { config = "or1k-elf"; libc = "newlib"; + platform = {}; }; arm-embedded = { @@ -183,6 +204,7 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; + platform = {}; }; iphone32 = { @@ -192,6 +214,7 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; + platform = {}; }; iphone64-simulator = { @@ -201,6 +224,7 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; + platform = {}; }; iphone32-simulator = { @@ -210,6 +234,7 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; + platform = {}; }; # @@ -220,6 +245,7 @@ rec { mingw32 = { config = "i686-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain + platform = {}; }; # 64 bit mingw-w64 @@ -227,6 +253,7 @@ rec { # That's the triplet they use in the mingw-w64 docs. config = "x86_64-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain + platform = {}; }; # BSDs @@ -248,5 +275,6 @@ rec { # Ghcjs ghcjs = { config = "js-unknown-ghcjs"; + platform = {}; }; } diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index f399c1873f5..e869de488c1 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -1,36 +1,39 @@ { lib }: rec { - pc = { - linux-kernel = { - name = "pc"; - - baseConfig = "defconfig"; - # Build whatever possible as a module, if not stated in the extra config. - autoModules = true; - target = "bzImage"; - }; + pcBase = { + name = "pc"; + kernelBaseConfig = "defconfig"; + # Build whatever possible as a module, if not stated in the extra config. + kernelAutoModules = true; + kernelTarget = "bzImage"; + }; + + pc64 = pcBase // { kernelArch = "x86_64"; }; + + pc32 = pcBase // { kernelArch = "i386"; }; + + pc32_simplekernel = pc32 // { + kernelAutoModules = false; }; - pc_simplekernel = lib.recursiveUpdate pc { - linux-kernel.autoModules = false; + pc64_simplekernel = pc64 // { + kernelAutoModules = false; }; powernv = { - linux-kernel = { - name = "PowerNV"; - - baseConfig = "powernv_defconfig"; - target = "zImage"; - installTarget = "install"; - file = "vmlinux"; - autoModules = true; - # avoid driver/FS trouble arising from unusual page size - extraConfig = '' - PPC_64K_PAGES n - PPC_4K_PAGES y - IPV6 y - ''; - }; + name = "PowerNV"; + kernelArch = "powerpc"; + kernelBaseConfig = "powernv_defconfig"; + kernelTarget = "zImage"; + kernelInstallTarget = "install"; + kernelFile = "vmlinux"; + kernelAutoModules = true; + # avoid driver/FS trouble arising from unusual page size + kernelExtraConfig = '' + PPC_64K_PAGES n + PPC_4K_PAGES y + IPV6 y + ''; }; ## @@ -38,121 +41,17 @@ rec { ## pogoplug4 = { - linux-kernel = { - name = "pogoplug4"; + name = "pogoplug4"; - baseConfig = "multi_v5_defconfig"; - autoModules = false; - extraConfig = '' - # Ubi for the mtd - MTD_UBI y - UBIFS_FS y - UBIFS_FS_XATTR y - UBIFS_FS_ADVANCED_COMPR y - UBIFS_FS_LZO y - UBIFS_FS_ZLIB y - UBIFS_FS_DEBUG n - ''; - makeFlags = [ "LOADADDR=0x8000" ]; - target = "uImage"; - # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working - #DTB = true; - }; gcc = { arch = "armv5te"; }; - }; - - sheevaplug = { - linux-kernel = { - name = "sheevaplug"; - - baseConfig = "multi_v5_defconfig"; - autoModules = false; - extraConfig = '' - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - BTRFS_FS m - XFS_FS m - JFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - # mv cesa requires this sw fallback, for mv-sha1 - CRYPTO_SHA1 y - # Fast crypto - CRYPTO_TWOFISH y - CRYPTO_TWOFISH_COMMON y - CRYPTO_BLOWFISH y - CRYPTO_BLOWFISH_COMMON y - - IP_PNP y - IP_PNP_DHCP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - NETFILTER y - IP_NF_IPTABLES y - IP_NF_FILTER y - IP_NF_MATCH_ADDRTYPE y - IP_NF_TARGET_LOG y - IP_NF_MANGLE y - IPV6 m - VLAN_8021Q m - - CIFS y - CIFS_XATTR y - CIFS_POSIX y - CIFS_FSCACHE y - CIFS_ACL y - - WATCHDOG y - WATCHDOG_CORE y - ORION_WATCHDOG m - - ZRAM m - NETCONSOLE m - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # systemd uses cgroups - CGROUPS y - - # Latencytop - LATENCYTOP y + kernelBaseConfig = "multi_v5_defconfig"; + kernelArch = "arm"; + kernelAutoModules = false; + kernelExtraConfig = + '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -161,36 +60,137 @@ rec { UBIFS_FS_LZO y UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n - - # Kdb, for kernel troubles - KGDB y - KGDB_SERIAL_CONSOLE y - KGDB_KDB y ''; - makeFlags = [ "LOADADDR=0x0200000" ]; - target = "uImage"; - DTB = true; # Beyond 3.10 - }; + kernelMakeFlags = [ "LOADADDR=0x8000" ]; + kernelTarget = "uImage"; + # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working + #kernelDTB = true; + }; + + sheevaplug = { + name = "sheevaplug"; + kernelBaseConfig = "multi_v5_defconfig"; + kernelArch = "arm"; + kernelAutoModules = false; + kernelExtraConfig = '' + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + BTRFS_FS m + XFS_FS m + JFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + # mv cesa requires this sw fallback, for mv-sha1 + CRYPTO_SHA1 y + # Fast crypto + CRYPTO_TWOFISH y + CRYPTO_TWOFISH_COMMON y + CRYPTO_BLOWFISH y + CRYPTO_BLOWFISH_COMMON y + + IP_PNP y + IP_PNP_DHCP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + NETFILTER y + IP_NF_IPTABLES y + IP_NF_FILTER y + IP_NF_MATCH_ADDRTYPE y + IP_NF_TARGET_LOG y + IP_NF_MANGLE y + IPV6 m + VLAN_8021Q m + + CIFS y + CIFS_XATTR y + CIFS_POSIX y + CIFS_FSCACHE y + CIFS_ACL y + + WATCHDOG y + WATCHDOG_CORE y + ORION_WATCHDOG m + + ZRAM m + NETCONSOLE m + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # systemd uses cgroups + CGROUPS y + + # Latencytop + LATENCYTOP y + + # Ubi for the mtd + MTD_UBI y + UBIFS_FS y + UBIFS_FS_XATTR y + UBIFS_FS_ADVANCED_COMPR y + UBIFS_FS_LZO y + UBIFS_FS_ZLIB y + UBIFS_FS_DEBUG n + + # Kdb, for kernel troubles + KGDB y + KGDB_SERIAL_CONSOLE y + KGDB_KDB y + ''; + kernelMakeFlags = [ "LOADADDR=0x0200000" ]; + kernelTarget = "uImage"; + kernelDTB = true; # Beyond 3.10 gcc = { arch = "armv5te"; }; }; raspberrypi = { - linux-kernel = { - name = "raspberrypi"; - - baseConfig = "bcm2835_defconfig"; - DTB = true; - autoModules = true; - preferBuiltin = true; - extraConfig = '' - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; - target = "zImage"; - }; + name = "raspberrypi"; + kernelBaseConfig = "bcm2835_defconfig"; + kernelDTB = true; + kernelArch = "arm"; + kernelAutoModules = true; + kernelPreferBuiltin = true; + kernelExtraConfig = '' + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; + kernelTarget = "zImage"; gcc = { arch = "armv6"; fpu = "vfp"; @@ -201,15 +201,13 @@ rec { raspberrypi2 = armv7l-hf-multiplatform; zero-gravitas = { - linux-kernel = { - name = "zero-gravitas"; - - baseConfig = "zero-gravitas_defconfig"; - # Target verified by checking /boot on reMarkable 1 device - target = "zImage"; - autoModules = false; - DTB = true; - }; + name = "zero-gravitas"; + kernelBaseConfig = "zero-gravitas_defconfig"; + kernelArch = "arm"; + # kernelTarget verified by checking /boot on reMarkable 1 device + kernelTarget = "zImage"; + kernelAutoModules = false; + kernelDTB = true; gcc = { fpu = "neon"; cpu = "cortex-a9"; @@ -217,15 +215,13 @@ rec { }; zero-sugar = { - linux-kernel = { - name = "zero-sugar"; - - baseConfig = "zero-sugar_defconfig"; - DTB = true; - autoModules = false; - preferBuiltin = true; - target = "zImage"; - }; + name = "zero-sugar"; + kernelBaseConfig = "zero-sugar_defconfig"; + kernelArch = "arm"; + kernelDTB = true; + kernelAutoModules = false; + kernelPreferBuiltin = true; + kernelTarget = "zImage"; gcc = { cpu = "cortex-a7"; fpu = "neon-vfpv4"; @@ -233,7 +229,7 @@ rec { }; }; - scaleway-c1 = lib.recursiveUpdate armv7l-hf-multiplatform { + scaleway-c1 = armv7l-hf-multiplatform // { gcc = { cpu = "cortex-a9"; fpu = "vfpv3"; @@ -241,11 +237,12 @@ rec { }; utilite = { - linux-kernel = { - name = "utilite"; - maseConfig = "multi_v7_defconfig"; - autoModules = false; - extraConfig = '' + name = "utilite"; + kernelBaseConfig = "multi_v7_defconfig"; + kernelArch = "arm"; + kernelAutoModules = false; + kernelExtraConfig = + '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -255,37 +252,35 @@ rec { UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n ''; - makeFlags = [ "LOADADDR=0x10800000" ]; - target = "uImage"; - DTB = true; - }; + kernelMakeFlags = [ "LOADADDR=0x10800000" ]; + kernelTarget = "uImage"; + kernelDTB = true; gcc = { cpu = "cortex-a9"; fpu = "neon"; }; }; - guruplug = lib.recursiveUpdate sheevaplug { + guruplug = sheevaplug // { # Define `CONFIG_MACH_GURUPLUG' (see # ) # and other GuruPlug-specific things. Requires the `guruplug-defconfig' # patch. - linux-kernel.baseConfig = "guruplug_defconfig"; + + kernelBaseConfig = "guruplug_defconfig"; }; - beaglebone = lib.recursiveUpdate armv7l-hf-multiplatform { - linux-kernel = { - name = "beaglebone"; - baseConfig = "bb.org_defconfig"; - autoModules = false; - extraConfig = ""; # TBD kernel config - target = "zImage"; - }; + beaglebone = armv7l-hf-multiplatform // { + name = "beaglebone"; + kernelBaseConfig = "bb.org_defconfig"; + kernelAutoModules = false; + kernelExtraConfig = ""; # TBD kernel config + kernelTarget = "zImage"; }; # https://developer.android.com/ndk/guides/abis#v7a - armv7a-android = { - linux-kernel.name = "armeabi-v7a"; + armv7a-android = { + name = "armeabi-v7a"; gcc = { arch = "armv7-a"; float-abi = "softfp"; @@ -294,31 +289,29 @@ rec { }; armv7l-hf-multiplatform = { - linux-kernel = { - name = "armv7l-hf-multiplatform"; - Major = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc. - baseConfig = "multi_v7_defconfig"; - DTB = true; - autoModules = true; - PreferBuiltin = true; - target = "zImage"; - extraConfig = '' - # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Fix broken sunxi-sid nvmem driver. - TI_CPTS y - - # Hangs ODROID-XU4 - ARM_BIG_LITTLE_CPUIDLE n - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; - }; + name = "armv7l-hf-multiplatform"; + kernelBaseConfig = "multi_v7_defconfig"; + kernelArch = "arm"; + kernelDTB = true; + kernelAutoModules = true; + kernelPreferBuiltin = true; + kernelTarget = "zImage"; + kernelExtraConfig = '' + # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Fix broken sunxi-sid nvmem driver. + TI_CPTS y + + # Hangs ODROID-XU4 + ARM_BIG_LITTLE_CPUIDLE n + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; gcc = { # Some table about fpu flags: # http://community.arm.com/servlet/JiveServlet/showImage/38-1981-3827/blogentry-103749-004812900+1365712953_thumb.png @@ -343,35 +336,34 @@ rec { }; aarch64-multiplatform = { - linux-kernel = { - name = "aarch64-multiplatform"; - baseConfig = "defconfig"; - DTB = true; - autoModules = true; - preferBuiltin = true; - extraConfig = '' - # Raspberry Pi 3 stuff. Not needed for s >= 4.10. - ARCH_BCM2835 y - BCM2835_MBOX y - BCM2835_WDT y - RASPBERRYPI_FIRMWARE y - RASPBERRYPI_POWER y - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Cavium ThunderX stuff. - PCI_HOST_THUNDER_ECAM y - - # Nvidia Tegra stuff. - PCI_TEGRA y - - # The default (=y) forces us to have the XHCI firmware available in initrd, - # which our initrd builder can't currently do easily. - USB_XHCI_TEGRA m - ''; - target = "Image"; - }; + name = "aarch64-multiplatform"; + kernelBaseConfig = "defconfig"; + kernelArch = "arm64"; + kernelDTB = true; + kernelAutoModules = true; + kernelPreferBuiltin = true; + kernelExtraConfig = '' + # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10. + ARCH_BCM2835 y + BCM2835_MBOX y + BCM2835_WDT y + RASPBERRYPI_FIRMWARE y + RASPBERRYPI_POWER y + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Cavium ThunderX stuff. + PCI_HOST_THUNDER_ECAM y + + # Nvidia Tegra stuff. + PCI_TEGRA y + + # The default (=y) forces us to have the XHCI firmware available in initrd, + # which our initrd builder can't currently do easily. + USB_XHCI_TEGRA m + ''; + kernelTarget = "Image"; gcc = { arch = "armv8-a"; }; @@ -382,9 +374,8 @@ rec { ## ben_nanonote = { - linux-kernel = { - name = "ben_nanonote"; - }; + name = "ben_nanonote"; + kernelArch = "mips"; gcc = { arch = "mips32"; float = "soft"; @@ -392,76 +383,75 @@ rec { }; fuloong2f_n32 = { - linux-kernel = { - name = "fuloong2f_n32"; - baseConfig = "lemote2f_defconfig"; - autoModules = false; - extraConfig = '' - MIGRATION n - COMPACTION n - - # nixos mounts some cgroup - CGROUPS y - - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - IP_PNP y - IP_PNP_DHCP y - IP_PNP_BOOTP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # Needed for udev >= 150 - SYSFS_DEPRECATED_V2 n - - VGA_CONSOLE n - VT_HW_CONSOLE_BINDING y - SERIAL_8250_CONSOLE y - FRAMEBUFFER_CONSOLE y - EXT2_FS y - EXT3_FS y - REISERFS_FS y - MAGIC_SYSRQ y - - # The kernel doesn't boot at all, with FTRACE - FTRACE n - ''; - target = "vmlinux"; - }; + name = "fuloong2f_n32"; + kernelBaseConfig = "lemote2f_defconfig"; + kernelArch = "mips"; + kernelAutoModules = false; + kernelExtraConfig = '' + MIGRATION n + COMPACTION n + + # nixos mounts some cgroup + CGROUPS y + + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + IP_PNP y + IP_PNP_DHCP y + IP_PNP_BOOTP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # Needed for udev >= 150 + SYSFS_DEPRECATED_V2 n + + VGA_CONSOLE n + VT_HW_CONSOLE_BINDING y + SERIAL_8250_CONSOLE y + FRAMEBUFFER_CONSOLE y + EXT2_FS y + EXT3_FS y + REISERFS_FS y + MAGIC_SYSRQ y + + # The kernel doesn't boot at all, with FTRACE + FTRACE n + ''; + kernelTarget = "vmlinux"; gcc = { arch = "loongson2f"; float = "hard"; @@ -474,36 +464,34 @@ rec { ## riscv-multiplatform = { - linux-kernel = { - name = "riscv-multiplatform"; - target = "vmlinux"; - autoModules = true; - baseConfig = "defconfig"; - extraConfig = '' - FTRACE n - SERIAL_OF_PLATFORM y - ''; - }; + name = "riscv-multiplatform"; + kernelArch = "riscv"; + kernelTarget = "vmlinux"; + kernelAutoModules = true; + kernelBaseConfig = "defconfig"; + kernelExtraConfig = '' + FTRACE n + SERIAL_OF_PLATFORM y + ''; }; select = platform: # x86 - /**/ if platform.isx86 then pc + /**/ if platform.isx86_32 then pc32 + else if platform.isx86_64 then pc64 # ARM else if platform.isAarch32 then let version = platform.parsed.cpu.version or null; - in if version == null then pc + in if version == null then pcBase else if lib.versionOlder version "6" then sheevaplug else if lib.versionOlder version "7" then raspberrypi else armv7l-hf-multiplatform else if platform.isAarch64 then aarch64-multiplatform - else if platform.isRiscV then riscv-multiplatform - else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv - else pc; + else pcBase; } diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml index c706cd30fce..94e42369b60 100644 --- a/nixos/doc/manual/release-notes/rl-2103.xml +++ b/nixos/doc/manual/release-notes/rl-2103.xml @@ -603,22 +603,6 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e /etc/netgroup defines network-wide groups and may affect to setups using NIS. - - - Platforms, like stdenv.hostPlatform, no longer have a platform attribute. - It has been (mostly) flattoned away: - - - platform.gcc is now gcc - platform.kernel* is now linux-kernel.* - - - Additionally, platform.kernelArch moved to the top level as linuxArch to match the other *Arch variables. - - - The platform grouping of these things never meant anything, and was just a historial/implementation artifact that was overdue removal. - - diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 4aa1d6369d1..e0ab37bca63 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -68,11 +68,11 @@ let patchShebangs scripts/* substituteInPlace scripts/Makefile.lib \ --replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@' - make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" - make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" + make ${pkgs.stdenv.hostPlatform.platform.kernelBaseConfig} ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" + make dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" ''; installPhase = '' - make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" + make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" ''; }; @@ -115,7 +115,7 @@ in options = { hardware.deviceTree = { enable = mkOption { - default = pkgs.stdenv.hostPlatform.linux-kernel.DTB or false; + default = pkgs.stdenv.hostPlatform.platform.kernelDTB or false; type = types.bool; description = '' Build device tree files. These are used to describe the diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix index fa074fdfcc6..95eba86bcb6 100644 --- a/nixos/modules/installer/netboot/netboot.nix +++ b/nixos/modules/installer/netboot/netboot.nix @@ -88,7 +88,7 @@ with lib; system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' #!ipxe - kernel ${pkgs.stdenv.hostPlatform.linux-kernel.target} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} + kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} initrd initrd boot ''; diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 64bdbf159d5..0eeff31d6c4 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -587,10 +587,10 @@ in nix.systemFeatures = mkDefault ( [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ - optionals (pkgs.hostPlatform ? gcc.arch) ( - # a builder can run code for `gcc.arch` and inferior architectures - [ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++ - map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch} + optionals (pkgs.hostPlatform.platform ? gcc.arch) ( + # a builder can run code for `platform.gcc.arch` and inferior architectures + [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ + map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch} ) ); diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index b0f77ca3fb8..03d7e749323 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -190,7 +190,7 @@ in system.boot.loader.kernelFile = mkOption { internal = true; - default = pkgs.stdenv.hostPlatform.linux-kernel.target; + default = pkgs.stdenv.hostPlatform.platform.kernelTarget; type = types.str; description = '' Name of the kernel file to be passed to the bootloader. diff --git a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix index fee567a510b..2d27611946e 100644 --- a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix +++ b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix @@ -59,7 +59,7 @@ in system.build.installBootLoader = generationsDirBuilder; system.boot.loader.id = "generationsDir"; - system.boot.loader.kernelFile = linux-kernel.target; + system.boot.loader.kernelFile = platform.kernelTarget; }; } diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix index db22dd36cbe..ba936b26573 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix @@ -103,6 +103,6 @@ in system.build.installBootLoader = builder; system.boot.loader.id = "raspberrypi"; - system.boot.loader.kernelFile = linux-kernel.target; + system.boot.loader.kernelFile = platform.kernelTarget; }; } diff --git a/nixos/release.nix b/nixos/release.nix index 109747945f7..1f5c1581269 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -79,7 +79,7 @@ let in tarball // { meta = { - description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}"; + description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.platform.name}"; maintainers = map (x: lib.maintainers.${x}) maintainers; }; inherit config; @@ -105,7 +105,7 @@ let modules = makeModules module {}; }; build = configEvaled.config.system.build; - kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target; + kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.platform.kernelTarget; in pkgs.symlinkJoin { name = "netboot"; diff --git a/pkgs/applications/audio/virtual-ans/default.nix b/pkgs/applications/audio/virtual-ans/default.nix index 1cb9c0f18bf..dd7e8b062da 100644 --- a/pkgs/applications/audio/virtual-ans/default.nix +++ b/pkgs/applications/audio/virtual-ans/default.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { startScript = if stdenv.isx86_32 then "START_LINUX_X86" else if stdenv.isx86_64 then "START_LINUX_X86_64" #else if stdenv.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin - else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; + else abort "Unsupported platform: ${stdenv.platform.kernelArch}."; linuxExecutable = if stdenv.isx86_32 then "pixilang_linux_x86" else if stdenv.isx86_64 then "pixilang_linux_x86_64" diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix index 848b93a5381..3ad540e5307 100644 --- a/pkgs/applications/virtualization/crosvm/default.nix +++ b/pkgs/applications/virtualization/crosvm/default.nix @@ -75,7 +75,7 @@ in CROSVM_CARGO_TEST_KERNEL_BINARY = lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) - "${linux}/${stdenv.hostPlatform.linux-kernel.target}"; + "${linux}/${stdenv.hostPlatform.platform.kernelTarget}"; passthru = { inherit adhdSrc; diff --git a/pkgs/applications/virtualization/vpcs/default.nix b/pkgs/applications/virtualization/vpcs/default.nix index 8c41a1f4c27..33d707a5007 100644 --- a/pkgs/applications/virtualization/vpcs/default.nix +++ b/pkgs/applications/virtualization/vpcs/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { buildPhase = ''( cd src - ./mk.sh ${stdenv.buildPlatform.linuxArch} + ./mk.sh ${stdenv.buildPlatform.platform.kernelArch} )''; installPhase = '' diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index e0d43739668..bd3ebdf800e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -190,7 +190,7 @@ stdenv.mkDerivation { else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" - else targetPlatform.bfdEmulation or (fmt + sep + arch); + else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); strictDeps = true; depsTargetTargetPropagated = extraPackages; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index faa62cb5b12..d1d5f8e6c86 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -403,31 +403,31 @@ stdenv.mkDerivation { # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in # that case. + optionalString ((targetPlatform ? platform.gcc.arch) && - isGccArchSupported targetPlatform.gcc.arch) '' - echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before + isGccArchSupported targetPlatform.platform.gcc.arch) '' + echo "-march=${targetPlatform.platform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' # -mcpu is not very useful. You should use mtune and march # instead. It’s provided here for backwards compatibility. + optionalString (targetPlatform ? platform.gcc.cpu) '' - echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before + echo "-mcpu=${targetPlatform.platform.gcc.cpu}" >> $out/nix-support/cc-cflags-before '' # -mfloat-abi only matters on arm32 but we set it here # unconditionally just in case. If the abi specifically sets hard # vs. soft floats we use it here. + optionalString (targetPlatform ? platform.gcc.float-abi) '' - echo "-mfloat-abi=${targetPlatform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before + echo "-mfloat-abi=${targetPlatform.platform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.fpu) '' - echo "-mfpu=${targetPlatform.gcc.fpu}" >> $out/nix-support/cc-cflags-before + echo "-mfpu=${targetPlatform.platform.gcc.fpu}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.mode) '' - echo "-mmode=${targetPlatform.gcc.mode}" >> $out/nix-support/cc-cflags-before + echo "-mmode=${targetPlatform.platform.gcc.mode}" >> $out/nix-support/cc-cflags-before '' + optionalString (targetPlatform ? platform.gcc.tune && - isGccArchSupported targetPlatform.gcc.tune) '' - echo "-mtune=${targetPlatform.gcc.tune}" >> $out/nix-support/cc-cflags-before + isGccArchSupported targetPlatform.platform.gcc.tune) '' + echo "-mtune=${targetPlatform.platform.gcc.tune}" >> $out/nix-support/cc-cflags-before '' # TODO: categorize these and figure out a better place for them diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix index 9af40d33242..901eb311a88 100644 --- a/pkgs/build-support/kernel/make-initrd.nix +++ b/pkgs/build-support/kernel/make-initrd.nix @@ -56,13 +56,13 @@ in , prepend ? [] # Whether to wrap the initramfs in a u-boot image. -, makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target == "uImage" +, makeUInitrd ? stdenvNoCC.hostPlatform.platform.kernelTarget == "uImage" # If generating a u-boot image, the architecture to use. The default # guess may not align with u-boot's nomenclature correctly, so it can # be overridden. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list. -, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch +, uInitrdArch ? stdenvNoCC.hostPlatform.kernelArch # The name of the compression, as recognised by u-boot. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list. diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 215782368f6..5f3c7e1d621 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -1,6 +1,6 @@ { pkgs , kernel ? pkgs.linux -, img ? pkgs.stdenv.hostPlatform.linux-kernel.target +, img ? pkgs.stdenv.hostPlatform.platform.kernelTarget , storeDir ? builtins.storeDir , rootModules ? [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" ] diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index 66af8c4a4cc..f3cdce41193 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -1,7 +1,7 @@ { lib, targetPlatform }: let - p = targetPlatform.gcc or {} + p = targetPlatform.platform.gcc or {} // targetPlatform.parsed.abi; in lib.concatLists [ (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64 diff --git a/pkgs/development/compilers/julia/1.0.nix b/pkgs/development/compilers/julia/1.0.nix index 78f7c2ef1b9..0325632ad0a 100644 --- a/pkgs/development/compilers/julia/1.0.nix +++ b/pkgs/development/compilers/julia/1.0.nix @@ -123,7 +123,7 @@ stdenv.mkDerivation rec { let arch = stdenv.lib.head (stdenv.lib.splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.3.nix b/pkgs/development/compilers/julia/1.3.nix index 2a270b7c72c..8096af0b320 100644 --- a/pkgs/development/compilers/julia/1.3.nix +++ b/pkgs/development/compilers/julia/1.3.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.5.nix b/pkgs/development/compilers/julia/1.5.nix index 778a9c3a9d7..be3cfc39635 100644 --- a/pkgs/development/compilers/julia/1.5.nix +++ b/pkgs/development/compilers/julia/1.5.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 6637a9bb2a3..6b17e463d76 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -158,7 +158,7 @@ stdenv.mkDerivation ({ "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ (lib.flip lib.withFeature "fp" - (stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) + (stdenv.hostPlatform.platform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) "--with-__thread" ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [ "--host=arm-linux-gnueabi" diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index 1a3f1948f84..e6ab23073b1 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix @@ -88,7 +88,7 @@ qtModule { NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit "-Wno-class-memaccess" - ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [ + ] ++ lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [ # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940 # TODO: investigate and fix properly "-march=westmere" diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix index edf556377b3..e333bd49718 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix @@ -73,9 +73,9 @@ let if isLinux then ( - x: x.platform == "manylinux1_${stdenv.hostPlatform.linuxArch}" - || x.platform == "manylinux2010_${stdenv.hostPlatform.linuxArch}" - || x.platform == "manylinux2014_${stdenv.hostPlatform.linuxArch}" + x: x.platform == "manylinux1_${stdenv.platform.kernelArch}" + || x.platform == "manylinux2010_${stdenv.platform.kernelArch}" + || x.platform == "manylinux2014_${stdenv.platform.kernelArch}" || x.platform == "any" ) else (x: hasInfix "macosx" x.platform || x.platform == "any"); diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix index ea2f27b0e22..ba8145398f5 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix @@ -95,7 +95,7 @@ let else if stdenv.isDarwin then "darwin" else throw "Unsupported platform" ); - platform_machine = stdenv.hostPlatform.linuxArch; + platform_machine = stdenv.platform.kernelArch; platform_python_implementation = let impl = python.passthru.implementation; diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index ccea8ee4553..5308149c26b 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -60,17 +60,18 @@ in configureFlags = let isCross = stdenv.hostPlatform != stdenv.buildPlatform; - inherit (stdenv.hostPlatform) gcc isArch32; + host = stdenv.hostPlatform.platform; + isAarch32 = stdenv.hostPlatform.isAarch32; in sharedConfigureFlags ++ [ "--without-dtrace" ] ++ (optionals isCross [ "--cross-compiling" "--without-intl" "--without-snapshot" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [ - "--with-arm-fpu=${gcc.fpu}" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [ - "--with-arm-float-abi=${gcc.float-abi}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" host.gcc) [ + "--with-arm-fpu=${host.gcc.fpu}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" host.gcc) [ + "--with-arm-float-abi=${host.gcc.float-abi}" ]) ++ (optionals (isCross && isAarch32) [ "--dest-cpu=arm" ]) ++ extraConfigFlags; diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix index 958bcdb9f16..88792346d70 100644 --- a/pkgs/os-specific/linux/exfat/default.nix +++ b/pkgs/os-specific/linux/exfat/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { makeFlags = [ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - "ARCH=${stdenv.hostPlatform.linuxArch}" + "ARCH=${stdenv.hostPlatform.platform.kernelArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index d6ed7bccba3..cadf65a7220 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -7,7 +7,7 @@ let pname = "linux-headers"; inherit version; - ARCH = stdenvNoCC.hostPlatform.linuxArch; + ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch; # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc. # We do this so we have a build->build, not build->host, C compiler. diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index ac9d6fbb2b5..31a90dc740f 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -42,7 +42,7 @@ # symbolic name and `patch' is the actual patch. The patch may # optionally be compressed with gzip or bzip2. kernelPatches ? [] -, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc" || +, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" || stdenv.hostPlatform != stdenv.buildPlatform , extraMeta ? {} @@ -51,10 +51,10 @@ , isLibre ? false , isHardened ? false -# easy overrides to stdenv.hostPlatform.linux-kernel members -, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules -, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false -, kernelArch ? stdenv.hostPlatform.linuxArch +# easy overrides to stdenv.hostPlatform.platform members +, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules +, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false +, kernelArch ? stdenv.hostPlatform.platform.kernelArch , ... }: @@ -87,7 +87,7 @@ let intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig # extra config in legacy string format + extraConfig - + stdenv.hostPlatform.linux-kernel.extraConfig or ""; + + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig; structuredConfigFromPatches = map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches; @@ -113,11 +113,11 @@ let nativeBuildInputs = [ perl gmp libmpc mpfr ] ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ]; - platformName = stdenv.hostPlatform.linux-kernel.name; + platformName = stdenv.hostPlatform.platform.name; # e.g. "defconfig" - kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig; + kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig; # e.g. "bzImage" - kernelTarget = stdenv.hostPlatform.linux-kernel.target; + kernelTarget = stdenv.hostPlatform.platform.kernelTarget; prePatch = kernel.prePatch + '' # Patch kconfig to print "###" after every question so that diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 2fc63322f5b..67016b71918 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -64,10 +64,10 @@ let commonMakeFlags = [ "O=$(buildRoot)" - ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags) - stdenv.hostPlatform.linux-kernel.makeFlags; + ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags) + stdenv.hostPlatform.platform.kernelMakeFlags; - drvAttrs = config_: kernelConf: kernelPatches: configfile: + drvAttrs = config_: platform: kernelPatches: configfile: let config = let attrName = attr: "CONFIG_" + attr; in { isSet = attr: hasAttr (attrName attr) config; @@ -171,7 +171,7 @@ let buildFlags = [ "KBUILD_BUILD_VERSION=1-NixOS" - kernelConf.target + platform.kernelTarget "vmlinux" # for "perf" and things like that ] ++ optional isModular "modules"; @@ -186,16 +186,16 @@ let ''; # Some image types need special install targets (e.g. uImage is installed with make uinstall) - installTargets = [ - (kernelConf.installTarget or ( - /**/ if kernelConf.target == "uImage" then "uinstall" - else if kernelConf.target == "zImage" || kernelConf.target == "Image.gz" then "zinstall" - else "install")) - ]; + installTargets = [ ( + if platform ? kernelInstallTarget then platform.kernelInstallTarget + else if platform.kernelTarget == "uImage" then "uinstall" + else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall" + else "install" + ) ]; postInstall = (optionalString installsFirmware '' mkdir -p $out/lib/firmware - '') + (if (kernelConf.DTB or false) then '' + '') + (if (platform ? kernelDTB && platform.kernelDTB) then '' make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs '' else "") + (if isModular then '' mkdir -p $dev @@ -300,7 +300,7 @@ in assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null; assert lib.versionAtLeast version "5.8" -> elfutils != null; -stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // { +stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // { pname = "linux"; inherit version; @@ -308,7 +308,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPat depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ] - ++ optional (stdenv.hostPlatform.linux-kernel.target == "uImage") buildPackages.ubootTools + ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools ++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf # Removed util-linuxMinimal since it should not be a dependency. ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ] @@ -322,10 +322,10 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPat makeFlags = commonMakeFlags ++ [ "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" - "ARCH=${stdenv.hostPlatform.linuxArch}" + "ARCH=${stdenv.hostPlatform.platform.kernelArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; - karch = stdenv.hostPlatform.linuxArch; + karch = stdenv.hostPlatform.platform.kernelArch; }) diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix index dc96f3b6a62..65ab71bd562 100644 --- a/pkgs/os-specific/linux/klibc/default.nix +++ b/pkgs/os-specific/linux/klibc/default.nix @@ -25,11 +25,11 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" "stackprotector" ]; makeFlags = commonMakeFlags ++ [ - "KLIBCARCH=${stdenv.hostPlatform.linuxArch}" + "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}" "KLIBCKERNELSRC=${linuxHeaders}" ] # TODO(@Ericson2314): We now can get the ABI from # `stdenv.hostPlatform.parsed.abi`, is this still a good idea? - ++ lib.optional (stdenv.hostPlatform.linuxArch == "arm") "CONFIG_AEABI=y" + ++ lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y" ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}"; # Install static binaries as well. diff --git a/pkgs/os-specific/linux/rtl8723bs/default.nix b/pkgs/os-specific/linux/rtl8723bs/default.nix index a862b351716..056fd40d252 100644 --- a/pkgs/os-specific/linux/rtl8723bs/default.nix +++ b/pkgs/os-specific/linux/rtl8723bs/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { buildInputs = [ nukeReferences ]; makeFlags = [ - "ARCH=${stdenv.hostPlatform.linuxArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. + "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us. ]; diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix index 68a88fb6778..aeed87d3c19 100644 --- a/pkgs/os-specific/linux/rtl8812au/default.nix +++ b/pkgs/os-specific/linux/rtl8812au/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { ''; makeFlags = [ - "ARCH=${stdenv.hostPlatform.linuxArch}" + "ARCH=${stdenv.hostPlatform.platform.kernelArch}" "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n")) ("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n")) diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix index 7508e1faf15..7c95a98372d 100644 --- a/pkgs/os-specific/linux/uclibc/default.nix +++ b/pkgs/os-specific/linux/uclibc/default.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation { cat << EOF | parseconfig ${nixConfig} ${extraConfig} - ${stdenv.hostPlatform.uclibc.extraConfig or ""} + ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""} EOF ( set +o pipefail; yes "" | make oldconfig ) ''; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index e8ccd02c041..0eb799e4525 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -279,7 +279,7 @@ in rec { } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? platform.gcc.arch) { - requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ]; + requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.platform.gcc.arch}" ]; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { inherit __darwinAllowLocalNetworking; # TODO: remove lib.unique once nix has a list canonicalization primitive diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ed9f3047969..bd86fed4cb2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19291,7 +19291,7 @@ in buildPhase = '' set -x make \ - ARCH=${stdenv.hostPlatform.linuxArch} \ + ARCH=${stdenv.hostPlatform.kernelArch} \ HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \ ${makeTarget} ''; -- cgit 1.4.1 From 9c213398b312e0f0bb9cdf05090fd20223a82ad0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 22 Jan 2021 20:33:55 -0500 Subject: lib: Clean up how linux and gcc config is specified Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that commit for details. This reverts commit 0bc275e63423456d6deb650e146120c39c1e0723. --- lib/systems/architectures.nix | 2 +- lib/systems/default.nix | 19 +- lib/systems/examples.nix | 48 +- lib/systems/platforms.nix | 670 +++++++++++---------- nixos/doc/manual/release-notes/rl-2103.xml | 16 + nixos/modules/hardware/device-tree.nix | 8 +- nixos/modules/installer/netboot/netboot.nix | 2 +- nixos/modules/services/misc/nix-daemon.nix | 8 +- nixos/modules/system/activation/top-level.nix | 2 +- .../loader/generations-dir/generations-dir.nix | 2 +- .../system/boot/loader/raspberrypi/raspberrypi.nix | 2 +- nixos/release.nix | 4 +- pkgs/applications/audio/virtual-ans/default.nix | 2 +- .../applications/virtualization/crosvm/default.nix | 2 +- pkgs/applications/virtualization/vpcs/default.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 2 +- pkgs/build-support/cc-wrapper/default.nix | 28 +- pkgs/build-support/kernel/make-initrd.nix | 4 +- pkgs/build-support/vm/default.nix | 2 +- .../compilers/gcc/common/platform-flags.nix | 2 +- pkgs/development/compilers/julia/1.0.nix | 2 +- pkgs/development/compilers/julia/1.3.nix | 2 +- pkgs/development/compilers/julia/1.5.nix | 2 +- pkgs/development/libraries/glibc/common.nix | 2 +- .../libraries/qt-5/modules/qtwebengine.nix | 2 +- .../tools/poetry2nix/poetry2nix/pep425.nix | 6 +- .../tools/poetry2nix/poetry2nix/pep508.nix | 2 +- pkgs/development/web/nodejs/nodejs.nix | 11 +- pkgs/os-specific/linux/exfat/default.nix | 2 +- pkgs/os-specific/linux/kernel-headers/default.nix | 2 +- pkgs/os-specific/linux/kernel/generic.nix | 18 +- pkgs/os-specific/linux/kernel/manual-config.nix | 30 +- pkgs/os-specific/linux/klibc/default.nix | 4 +- pkgs/os-specific/linux/rtl8723bs/default.nix | 2 +- pkgs/os-specific/linux/rtl8812au/default.nix | 2 +- pkgs/os-specific/linux/uclibc/default.nix | 2 +- pkgs/stdenv/generic/make-derivation.nix | 4 +- pkgs/top-level/all-packages.nix | 2 +- 38 files changed, 465 insertions(+), 459 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index 8e3a56b0d7c..ddc320d24e0 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -1,7 +1,7 @@ { lib }: rec { - # platform.gcc.arch to its features (as in /proc/cpuinfo) + # gcc.arch to its features (as in /proc/cpuinfo) features = { default = [ ]; # x86_64 Intel diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 4edcbeb36f1..1a89120e2bf 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -24,8 +24,6 @@ rec { # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; - # Just a guess, based on `system` - platform = platforms.select final; # Determine whether we are compatible with the provided CPU isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu; # Derived meta-data @@ -79,11 +77,20 @@ rec { }; isStatic = final.isWasm || final.isRedox; - kernelArch = + # Just a guess, based on `system` + inherit + ({ + linux-kernel = args.linux-kernel or {}; + gcc = args.gcc or {}; + rustc = args.rust or {}; + } // platforms.select final) + linux-kernel gcc rustc; + + linuxArch = if final.isAarch32 then "arm" else if final.isAarch64 then "arm64" - else if final.isx86_32 then "x86" - else if final.isx86_64 then "x86" + else if final.isx86_32 then "i386" + else if final.isx86_64 then "x86_64" else if final.isMips then "mips" else final.parsed.cpu.name; @@ -129,7 +136,7 @@ rec { else throw "Don't know how to run ${final.config} executables."; } // mapAttrs (n: v: v final.parsed) inspect.predicates - // mapAttrs (n: v: v final.platform.gcc.arch or "default") architectures.predicates + // mapAttrs (n: v: v final.gcc.arch or "default") architectures.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; assert lib.foldl diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 16002450f2d..de12e0b83c1 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -7,7 +7,6 @@ let riscv = bits: { config = "riscv${bits}-unknown-linux-gnu"; - platform = platforms.riscv-multiplatform; }; in @@ -17,84 +16,68 @@ rec { # powernv = { config = "powerpc64le-unknown-linux-gnu"; - platform = platforms.powernv; }; musl-power = { config = "powerpc64le-unknown-linux-musl"; - platform = platforms.powernv; }; sheevaplug = { config = "armv5tel-unknown-linux-gnueabi"; - platform = platforms.sheevaplug; - }; + } // platforms.sheevaplug; raspberryPi = { config = "armv6l-unknown-linux-gnueabihf"; - platform = platforms.raspberrypi; - }; + } // platforms.raspberrypi; remarkable1 = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.zero-gravitas; - }; + } // platforms.zero-gravitas; remarkable2 = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.zero-sugar; - }; + } // platforms.zero-sugar; armv7l-hf-multiplatform = { config = "armv7l-unknown-linux-gnueabihf"; - platform = platforms.armv7l-hf-multiplatform; }; aarch64-multiplatform = { config = "aarch64-unknown-linux-gnu"; - platform = platforms.aarch64-multiplatform; }; armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; sdkVer = "29"; ndkVer = "21"; - platform = platforms.armv7a-android; useAndroidPrebuilt = true; - }; + } // platforms.armv7a-android; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; sdkVer = "29"; ndkVer = "21"; - platform = platforms.aarch64-multiplatform; useAndroidPrebuilt = true; }; - scaleway-c1 = armv7l-hf-multiplatform // rec { - platform = platforms.scaleway-c1; - inherit (platform.gcc) fpu; - }; + scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1; pogoplug4 = { config = "armv5tel-unknown-linux-gnueabi"; - platform = platforms.pogoplug4; - }; + } // platforms.pogoplug4; ben-nanonote = { config = "mipsel-unknown-linux-uclibc"; - platform = platforms.ben_nanonote; - }; + } // platforms.ben_nanonote; fuloongminipc = { config = "mipsel-unknown-linux-gnu"; - platform = platforms.fuloong2f_n32; - }; + } // platforms.fuloong2f_n32; muslpi = raspberryPi // { config = "armv6l-unknown-linux-musleabihf"; }; - aarch64-multiplatform-musl = aarch64-multiplatform // { + aarch64-multiplatform-musl = { config = "aarch64-unknown-linux-musl"; }; @@ -110,13 +93,11 @@ rec { riscv64-embedded = { config = "riscv64-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform; }; riscv32-embedded = { config = "riscv32-none-elf"; libc = "newlib"; - platform = platforms.riscv-multiplatform; }; mmix = { @@ -136,13 +117,11 @@ rec { vc4 = { config = "vc4-elf"; libc = "newlib"; - platform = {}; }; or1k = { config = "or1k-elf"; libc = "newlib"; - platform = {}; }; arm-embedded = { @@ -204,7 +183,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; - platform = {}; }; iphone32 = { @@ -214,7 +192,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneOS"; useiOSPrebuilt = true; - platform = {}; }; iphone64-simulator = { @@ -224,7 +201,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; - platform = {}; }; iphone32-simulator = { @@ -234,7 +210,6 @@ rec { xcodeVer = "11.3.1"; xcodePlatform = "iPhoneSimulator"; useiOSPrebuilt = true; - platform = {}; }; # @@ -245,7 +220,6 @@ rec { mingw32 = { config = "i686-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain - platform = {}; }; # 64 bit mingw-w64 @@ -253,7 +227,6 @@ rec { # That's the triplet they use in the mingw-w64 docs. config = "x86_64-w64-mingw32"; libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain - platform = {}; }; # BSDs @@ -275,6 +248,5 @@ rec { # Ghcjs ghcjs = { config = "js-unknown-ghcjs"; - platform = {}; }; } diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index e869de488c1..f399c1873f5 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -1,39 +1,36 @@ { lib }: rec { - pcBase = { - name = "pc"; - kernelBaseConfig = "defconfig"; - # Build whatever possible as a module, if not stated in the extra config. - kernelAutoModules = true; - kernelTarget = "bzImage"; - }; - - pc64 = pcBase // { kernelArch = "x86_64"; }; - - pc32 = pcBase // { kernelArch = "i386"; }; - - pc32_simplekernel = pc32 // { - kernelAutoModules = false; + pc = { + linux-kernel = { + name = "pc"; + + baseConfig = "defconfig"; + # Build whatever possible as a module, if not stated in the extra config. + autoModules = true; + target = "bzImage"; + }; }; - pc64_simplekernel = pc64 // { - kernelAutoModules = false; + pc_simplekernel = lib.recursiveUpdate pc { + linux-kernel.autoModules = false; }; powernv = { - name = "PowerNV"; - kernelArch = "powerpc"; - kernelBaseConfig = "powernv_defconfig"; - kernelTarget = "zImage"; - kernelInstallTarget = "install"; - kernelFile = "vmlinux"; - kernelAutoModules = true; - # avoid driver/FS trouble arising from unusual page size - kernelExtraConfig = '' - PPC_64K_PAGES n - PPC_4K_PAGES y - IPV6 y - ''; + linux-kernel = { + name = "PowerNV"; + + baseConfig = "powernv_defconfig"; + target = "zImage"; + installTarget = "install"; + file = "vmlinux"; + autoModules = true; + # avoid driver/FS trouble arising from unusual page size + extraConfig = '' + PPC_64K_PAGES n + PPC_4K_PAGES y + IPV6 y + ''; + }; }; ## @@ -41,17 +38,121 @@ rec { ## pogoplug4 = { - name = "pogoplug4"; + linux-kernel = { + name = "pogoplug4"; + baseConfig = "multi_v5_defconfig"; + autoModules = false; + extraConfig = '' + # Ubi for the mtd + MTD_UBI y + UBIFS_FS y + UBIFS_FS_XATTR y + UBIFS_FS_ADVANCED_COMPR y + UBIFS_FS_LZO y + UBIFS_FS_ZLIB y + UBIFS_FS_DEBUG n + ''; + makeFlags = [ "LOADADDR=0x8000" ]; + target = "uImage"; + # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working + #DTB = true; + }; gcc = { arch = "armv5te"; }; + }; + + sheevaplug = { + linux-kernel = { + name = "sheevaplug"; + + baseConfig = "multi_v5_defconfig"; + autoModules = false; + extraConfig = '' + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + BTRFS_FS m + XFS_FS m + JFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + # mv cesa requires this sw fallback, for mv-sha1 + CRYPTO_SHA1 y + # Fast crypto + CRYPTO_TWOFISH y + CRYPTO_TWOFISH_COMMON y + CRYPTO_BLOWFISH y + CRYPTO_BLOWFISH_COMMON y + + IP_PNP y + IP_PNP_DHCP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + NETFILTER y + IP_NF_IPTABLES y + IP_NF_FILTER y + IP_NF_MATCH_ADDRTYPE y + IP_NF_TARGET_LOG y + IP_NF_MANGLE y + IPV6 m + VLAN_8021Q m + + CIFS y + CIFS_XATTR y + CIFS_POSIX y + CIFS_FSCACHE y + CIFS_ACL y + + WATCHDOG y + WATCHDOG_CORE y + ORION_WATCHDOG m + + ZRAM m + NETCONSOLE m + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # systemd uses cgroups + CGROUPS y + + # Latencytop + LATENCYTOP y - kernelBaseConfig = "multi_v5_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = - '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -60,137 +161,36 @@ rec { UBIFS_FS_LZO y UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n - ''; - kernelMakeFlags = [ "LOADADDR=0x8000" ]; - kernelTarget = "uImage"; - # TODO reenable once manual-config's config actually builds a .dtb and this is checked to be working - #kernelDTB = true; - }; - sheevaplug = { - name = "sheevaplug"; - kernelBaseConfig = "multi_v5_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = '' - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - BTRFS_FS m - XFS_FS m - JFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - # mv cesa requires this sw fallback, for mv-sha1 - CRYPTO_SHA1 y - # Fast crypto - CRYPTO_TWOFISH y - CRYPTO_TWOFISH_COMMON y - CRYPTO_BLOWFISH y - CRYPTO_BLOWFISH_COMMON y - - IP_PNP y - IP_PNP_DHCP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - NETFILTER y - IP_NF_IPTABLES y - IP_NF_FILTER y - IP_NF_MATCH_ADDRTYPE y - IP_NF_TARGET_LOG y - IP_NF_MANGLE y - IPV6 m - VLAN_8021Q m - - CIFS y - CIFS_XATTR y - CIFS_POSIX y - CIFS_FSCACHE y - CIFS_ACL y - - WATCHDOG y - WATCHDOG_CORE y - ORION_WATCHDOG m - - ZRAM m - NETCONSOLE m - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # systemd uses cgroups - CGROUPS y - - # Latencytop - LATENCYTOP y - - # Ubi for the mtd - MTD_UBI y - UBIFS_FS y - UBIFS_FS_XATTR y - UBIFS_FS_ADVANCED_COMPR y - UBIFS_FS_LZO y - UBIFS_FS_ZLIB y - UBIFS_FS_DEBUG n - - # Kdb, for kernel troubles - KGDB y - KGDB_SERIAL_CONSOLE y - KGDB_KDB y - ''; - kernelMakeFlags = [ "LOADADDR=0x0200000" ]; - kernelTarget = "uImage"; - kernelDTB = true; # Beyond 3.10 + # Kdb, for kernel troubles + KGDB y + KGDB_SERIAL_CONSOLE y + KGDB_KDB y + ''; + makeFlags = [ "LOADADDR=0x0200000" ]; + target = "uImage"; + DTB = true; # Beyond 3.10 + }; gcc = { arch = "armv5te"; }; }; raspberrypi = { - name = "raspberrypi"; - kernelBaseConfig = "bcm2835_defconfig"; - kernelDTB = true; - kernelArch = "arm"; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelExtraConfig = '' - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; - kernelTarget = "zImage"; + linux-kernel = { + name = "raspberrypi"; + + baseConfig = "bcm2835_defconfig"; + DTB = true; + autoModules = true; + preferBuiltin = true; + extraConfig = '' + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; + target = "zImage"; + }; gcc = { arch = "armv6"; fpu = "vfp"; @@ -201,13 +201,15 @@ rec { raspberrypi2 = armv7l-hf-multiplatform; zero-gravitas = { - name = "zero-gravitas"; - kernelBaseConfig = "zero-gravitas_defconfig"; - kernelArch = "arm"; - # kernelTarget verified by checking /boot on reMarkable 1 device - kernelTarget = "zImage"; - kernelAutoModules = false; - kernelDTB = true; + linux-kernel = { + name = "zero-gravitas"; + + baseConfig = "zero-gravitas_defconfig"; + # Target verified by checking /boot on reMarkable 1 device + target = "zImage"; + autoModules = false; + DTB = true; + }; gcc = { fpu = "neon"; cpu = "cortex-a9"; @@ -215,13 +217,15 @@ rec { }; zero-sugar = { - name = "zero-sugar"; - kernelBaseConfig = "zero-sugar_defconfig"; - kernelArch = "arm"; - kernelDTB = true; - kernelAutoModules = false; - kernelPreferBuiltin = true; - kernelTarget = "zImage"; + linux-kernel = { + name = "zero-sugar"; + + baseConfig = "zero-sugar_defconfig"; + DTB = true; + autoModules = false; + preferBuiltin = true; + target = "zImage"; + }; gcc = { cpu = "cortex-a7"; fpu = "neon-vfpv4"; @@ -229,7 +233,7 @@ rec { }; }; - scaleway-c1 = armv7l-hf-multiplatform // { + scaleway-c1 = lib.recursiveUpdate armv7l-hf-multiplatform { gcc = { cpu = "cortex-a9"; fpu = "vfpv3"; @@ -237,12 +241,11 @@ rec { }; utilite = { - name = "utilite"; - kernelBaseConfig = "multi_v7_defconfig"; - kernelArch = "arm"; - kernelAutoModules = false; - kernelExtraConfig = - '' + linux-kernel = { + name = "utilite"; + maseConfig = "multi_v7_defconfig"; + autoModules = false; + extraConfig = '' # Ubi for the mtd MTD_UBI y UBIFS_FS y @@ -252,35 +255,37 @@ rec { UBIFS_FS_ZLIB y UBIFS_FS_DEBUG n ''; - kernelMakeFlags = [ "LOADADDR=0x10800000" ]; - kernelTarget = "uImage"; - kernelDTB = true; + makeFlags = [ "LOADADDR=0x10800000" ]; + target = "uImage"; + DTB = true; + }; gcc = { cpu = "cortex-a9"; fpu = "neon"; }; }; - guruplug = sheevaplug // { + guruplug = lib.recursiveUpdate sheevaplug { # Define `CONFIG_MACH_GURUPLUG' (see # ) # and other GuruPlug-specific things. Requires the `guruplug-defconfig' # patch. - - kernelBaseConfig = "guruplug_defconfig"; + linux-kernel.baseConfig = "guruplug_defconfig"; }; - beaglebone = armv7l-hf-multiplatform // { - name = "beaglebone"; - kernelBaseConfig = "bb.org_defconfig"; - kernelAutoModules = false; - kernelExtraConfig = ""; # TBD kernel config - kernelTarget = "zImage"; + beaglebone = lib.recursiveUpdate armv7l-hf-multiplatform { + linux-kernel = { + name = "beaglebone"; + baseConfig = "bb.org_defconfig"; + autoModules = false; + extraConfig = ""; # TBD kernel config + target = "zImage"; + }; }; # https://developer.android.com/ndk/guides/abis#v7a - armv7a-android = { - name = "armeabi-v7a"; + armv7a-android = { + linux-kernel.name = "armeabi-v7a"; gcc = { arch = "armv7-a"; float-abi = "softfp"; @@ -289,29 +294,31 @@ rec { }; armv7l-hf-multiplatform = { - name = "armv7l-hf-multiplatform"; - kernelBaseConfig = "multi_v7_defconfig"; - kernelArch = "arm"; - kernelDTB = true; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelTarget = "zImage"; - kernelExtraConfig = '' - # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Fix broken sunxi-sid nvmem driver. - TI_CPTS y - - # Hangs ODROID-XU4 - ARM_BIG_LITTLE_CPUIDLE n - - # Disable OABI to have seccomp_filter (required for systemd) - # https://github.com/raspberrypi/firmware/issues/651 - OABI_COMPAT n - ''; + linux-kernel = { + name = "armv7l-hf-multiplatform"; + Major = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc. + baseConfig = "multi_v7_defconfig"; + DTB = true; + autoModules = true; + PreferBuiltin = true; + target = "zImage"; + extraConfig = '' + # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Fix broken sunxi-sid nvmem driver. + TI_CPTS y + + # Hangs ODROID-XU4 + ARM_BIG_LITTLE_CPUIDLE n + + # Disable OABI to have seccomp_filter (required for systemd) + # https://github.com/raspberrypi/firmware/issues/651 + OABI_COMPAT n + ''; + }; gcc = { # Some table about fpu flags: # http://community.arm.com/servlet/JiveServlet/showImage/38-1981-3827/blogentry-103749-004812900+1365712953_thumb.png @@ -336,34 +343,35 @@ rec { }; aarch64-multiplatform = { - name = "aarch64-multiplatform"; - kernelBaseConfig = "defconfig"; - kernelArch = "arm64"; - kernelDTB = true; - kernelAutoModules = true; - kernelPreferBuiltin = true; - kernelExtraConfig = '' - # Raspberry Pi 3 stuff. Not needed for kernels >= 4.10. - ARCH_BCM2835 y - BCM2835_MBOX y - BCM2835_WDT y - RASPBERRYPI_FIRMWARE y - RASPBERRYPI_POWER y - SERIAL_8250_BCM2835AUX y - SERIAL_8250_EXTENDED y - SERIAL_8250_SHARE_IRQ y - - # Cavium ThunderX stuff. - PCI_HOST_THUNDER_ECAM y - - # Nvidia Tegra stuff. - PCI_TEGRA y - - # The default (=y) forces us to have the XHCI firmware available in initrd, - # which our initrd builder can't currently do easily. - USB_XHCI_TEGRA m - ''; - kernelTarget = "Image"; + linux-kernel = { + name = "aarch64-multiplatform"; + baseConfig = "defconfig"; + DTB = true; + autoModules = true; + preferBuiltin = true; + extraConfig = '' + # Raspberry Pi 3 stuff. Not needed for s >= 4.10. + ARCH_BCM2835 y + BCM2835_MBOX y + BCM2835_WDT y + RASPBERRYPI_FIRMWARE y + RASPBERRYPI_POWER y + SERIAL_8250_BCM2835AUX y + SERIAL_8250_EXTENDED y + SERIAL_8250_SHARE_IRQ y + + # Cavium ThunderX stuff. + PCI_HOST_THUNDER_ECAM y + + # Nvidia Tegra stuff. + PCI_TEGRA y + + # The default (=y) forces us to have the XHCI firmware available in initrd, + # which our initrd builder can't currently do easily. + USB_XHCI_TEGRA m + ''; + target = "Image"; + }; gcc = { arch = "armv8-a"; }; @@ -374,8 +382,9 @@ rec { ## ben_nanonote = { - name = "ben_nanonote"; - kernelArch = "mips"; + linux-kernel = { + name = "ben_nanonote"; + }; gcc = { arch = "mips32"; float = "soft"; @@ -383,75 +392,76 @@ rec { }; fuloong2f_n32 = { - name = "fuloong2f_n32"; - kernelBaseConfig = "lemote2f_defconfig"; - kernelArch = "mips"; - kernelAutoModules = false; - kernelExtraConfig = '' - MIGRATION n - COMPACTION n - - # nixos mounts some cgroup - CGROUPS y - - BLK_DEV_RAM y - BLK_DEV_INITRD y - BLK_DEV_CRYPTOLOOP m - BLK_DEV_DM m - DM_CRYPT m - MD y - REISERFS_FS m - EXT4_FS m - USB_STORAGE_CYPRESS_ATACB m - - IP_PNP y - IP_PNP_DHCP y - IP_PNP_BOOTP y - NFS_FS y - ROOT_NFS y - TUN m - NFS_V4 y - NFS_V4_1 y - NFS_FSCACHE y - NFSD m - NFSD_V2_ACL y - NFSD_V3 y - NFSD_V3_ACL y - NFSD_V4 y - - # Fail to build - DRM n - SCSI_ADVANSYS n - USB_ISP1362_HCD n - SND_SOC n - SND_ALI5451 n - FB_SAVAGE n - SCSI_NSP32 n - ATA_SFF n - SUNGEM n - IRDA n - ATM_HE n - SCSI_ACARD n - BLK_DEV_CMD640_ENHANCED n - - FUSE_FS m - - # Needed for udev >= 150 - SYSFS_DEPRECATED_V2 n - - VGA_CONSOLE n - VT_HW_CONSOLE_BINDING y - SERIAL_8250_CONSOLE y - FRAMEBUFFER_CONSOLE y - EXT2_FS y - EXT3_FS y - REISERFS_FS y - MAGIC_SYSRQ y - - # The kernel doesn't boot at all, with FTRACE - FTRACE n - ''; - kernelTarget = "vmlinux"; + linux-kernel = { + name = "fuloong2f_n32"; + baseConfig = "lemote2f_defconfig"; + autoModules = false; + extraConfig = '' + MIGRATION n + COMPACTION n + + # nixos mounts some cgroup + CGROUPS y + + BLK_DEV_RAM y + BLK_DEV_INITRD y + BLK_DEV_CRYPTOLOOP m + BLK_DEV_DM m + DM_CRYPT m + MD y + REISERFS_FS m + EXT4_FS m + USB_STORAGE_CYPRESS_ATACB m + + IP_PNP y + IP_PNP_DHCP y + IP_PNP_BOOTP y + NFS_FS y + ROOT_NFS y + TUN m + NFS_V4 y + NFS_V4_1 y + NFS_FSCACHE y + NFSD m + NFSD_V2_ACL y + NFSD_V3 y + NFSD_V3_ACL y + NFSD_V4 y + + # Fail to build + DRM n + SCSI_ADVANSYS n + USB_ISP1362_HCD n + SND_SOC n + SND_ALI5451 n + FB_SAVAGE n + SCSI_NSP32 n + ATA_SFF n + SUNGEM n + IRDA n + ATM_HE n + SCSI_ACARD n + BLK_DEV_CMD640_ENHANCED n + + FUSE_FS m + + # Needed for udev >= 150 + SYSFS_DEPRECATED_V2 n + + VGA_CONSOLE n + VT_HW_CONSOLE_BINDING y + SERIAL_8250_CONSOLE y + FRAMEBUFFER_CONSOLE y + EXT2_FS y + EXT3_FS y + REISERFS_FS y + MAGIC_SYSRQ y + + # The kernel doesn't boot at all, with FTRACE + FTRACE n + ''; + target = "vmlinux"; + }; gcc = { arch = "loongson2f"; float = "hard"; @@ -464,34 +474,36 @@ rec { ## riscv-multiplatform = { - name = "riscv-multiplatform"; - kernelArch = "riscv"; - kernelTarget = "vmlinux"; - kernelAutoModules = true; - kernelBaseConfig = "defconfig"; - kernelExtraConfig = '' - FTRACE n - SERIAL_OF_PLATFORM y - ''; + linux-kernel = { + name = "riscv-multiplatform"; + target = "vmlinux"; + autoModules = true; + baseConfig = "defconfig"; + extraConfig = '' + FTRACE n + SERIAL_OF_PLATFORM y + ''; + }; }; select = platform: # x86 - /**/ if platform.isx86_32 then pc32 - else if platform.isx86_64 then pc64 + /**/ if platform.isx86 then pc # ARM else if platform.isAarch32 then let version = platform.parsed.cpu.version or null; - in if version == null then pcBase + in if version == null then pc else if lib.versionOlder version "6" then sheevaplug else if lib.versionOlder version "7" then raspberrypi else armv7l-hf-multiplatform else if platform.isAarch64 then aarch64-multiplatform + else if platform.isRiscV then riscv-multiplatform + else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32 else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv - else pcBase; + else pc; } diff --git a/nixos/doc/manual/release-notes/rl-2103.xml b/nixos/doc/manual/release-notes/rl-2103.xml index 94e42369b60..c706cd30fce 100644 --- a/nixos/doc/manual/release-notes/rl-2103.xml +++ b/nixos/doc/manual/release-notes/rl-2103.xml @@ -603,6 +603,22 @@ http://some.json-exporter.host:7979/probe?target=https://example.com/some/json/e /etc/netgroup defines network-wide groups and may affect to setups using NIS. + + + Platforms, like stdenv.hostPlatform, no longer have a platform attribute. + It has been (mostly) flattoned away: + + + platform.gcc is now gcc + platform.kernel* is now linux-kernel.* + + + Additionally, platform.kernelArch moved to the top level as linuxArch to match the other *Arch variables. + + + The platform grouping of these things never meant anything, and was just a historial/implementation artifact that was overdue removal. + + diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index e0ab37bca63..4aa1d6369d1 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -68,11 +68,11 @@ let patchShebangs scripts/* substituteInPlace scripts/Makefile.lib \ --replace 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget))' 'DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) -@' - make ${pkgs.stdenv.hostPlatform.platform.kernelBaseConfig} ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" - make dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" + make ${pkgs.stdenv.hostPlatform.linux-kernel.baseConfig} ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" + make dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" ''; installPhase = '' - make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.platform.kernelArch}" + make dtbs_install INSTALL_DTBS_PATH=$out/dtbs ARCH="${pkgs.stdenv.hostPlatform.linuxArch}" ''; }; @@ -115,7 +115,7 @@ in options = { hardware.deviceTree = { enable = mkOption { - default = pkgs.stdenv.hostPlatform.platform.kernelDTB or false; + default = pkgs.stdenv.hostPlatform.linux-kernel.DTB or false; type = types.bool; description = '' Build device tree files. These are used to describe the diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix index 95eba86bcb6..fa074fdfcc6 100644 --- a/nixos/modules/installer/netboot/netboot.nix +++ b/nixos/modules/installer/netboot/netboot.nix @@ -88,7 +88,7 @@ with lib; system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' #!ipxe - kernel ${pkgs.stdenv.hostPlatform.platform.kernelTarget} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} + kernel ${pkgs.stdenv.hostPlatform.linux-kernel.target} init=${config.system.build.toplevel}/init initrd=initrd ${toString config.boot.kernelParams} initrd initrd boot ''; diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 0eeff31d6c4..64bdbf159d5 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -587,10 +587,10 @@ in nix.systemFeatures = mkDefault ( [ "nixos-test" "benchmark" "big-parallel" "kvm" ] ++ - optionals (pkgs.hostPlatform.platform ? gcc.arch) ( - # a builder can run code for `platform.gcc.arch` and inferior architectures - [ "gccarch-${pkgs.hostPlatform.platform.gcc.arch}" ] ++ - map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.platform.gcc.arch} + optionals (pkgs.hostPlatform ? gcc.arch) ( + # a builder can run code for `gcc.arch` and inferior architectures + [ "gccarch-${pkgs.hostPlatform.gcc.arch}" ] ++ + map (x: "gccarch-${x}") lib.systems.architectures.inferiors.${pkgs.hostPlatform.gcc.arch} ) ); diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 03d7e749323..b0f77ca3fb8 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -190,7 +190,7 @@ in system.boot.loader.kernelFile = mkOption { internal = true; - default = pkgs.stdenv.hostPlatform.platform.kernelTarget; + default = pkgs.stdenv.hostPlatform.linux-kernel.target; type = types.str; description = '' Name of the kernel file to be passed to the bootloader. diff --git a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix index 2d27611946e..fee567a510b 100644 --- a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix +++ b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix @@ -59,7 +59,7 @@ in system.build.installBootLoader = generationsDirBuilder; system.boot.loader.id = "generationsDir"; - system.boot.loader.kernelFile = platform.kernelTarget; + system.boot.loader.kernelFile = linux-kernel.target; }; } diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix index ba936b26573..db22dd36cbe 100644 --- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix +++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix @@ -103,6 +103,6 @@ in system.build.installBootLoader = builder; system.boot.loader.id = "raspberrypi"; - system.boot.loader.kernelFile = platform.kernelTarget; + system.boot.loader.kernelFile = linux-kernel.target; }; } diff --git a/nixos/release.nix b/nixos/release.nix index 1f5c1581269..109747945f7 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -79,7 +79,7 @@ let in tarball // { meta = { - description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.platform.name}"; + description = "NixOS system tarball for ${system} - ${stdenv.hostPlatform.linux-kernel.name}"; maintainers = map (x: lib.maintainers.${x}) maintainers; }; inherit config; @@ -105,7 +105,7 @@ let modules = makeModules module {}; }; build = configEvaled.config.system.build; - kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.platform.kernelTarget; + kernelTarget = configEvaled.pkgs.stdenv.hostPlatform.linux-kernel.target; in pkgs.symlinkJoin { name = "netboot"; diff --git a/pkgs/applications/audio/virtual-ans/default.nix b/pkgs/applications/audio/virtual-ans/default.nix index dd7e8b062da..1cb9c0f18bf 100644 --- a/pkgs/applications/audio/virtual-ans/default.nix +++ b/pkgs/applications/audio/virtual-ans/default.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { startScript = if stdenv.isx86_32 then "START_LINUX_X86" else if stdenv.isx86_64 then "START_LINUX_X86_64" #else if stdenv.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin - else abort "Unsupported platform: ${stdenv.platform.kernelArch}."; + else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; linuxExecutable = if stdenv.isx86_32 then "pixilang_linux_x86" else if stdenv.isx86_64 then "pixilang_linux_x86_64" diff --git a/pkgs/applications/virtualization/crosvm/default.nix b/pkgs/applications/virtualization/crosvm/default.nix index 3ad540e5307..848b93a5381 100644 --- a/pkgs/applications/virtualization/crosvm/default.nix +++ b/pkgs/applications/virtualization/crosvm/default.nix @@ -75,7 +75,7 @@ in CROSVM_CARGO_TEST_KERNEL_BINARY = lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) - "${linux}/${stdenv.hostPlatform.platform.kernelTarget}"; + "${linux}/${stdenv.hostPlatform.linux-kernel.target}"; passthru = { inherit adhdSrc; diff --git a/pkgs/applications/virtualization/vpcs/default.nix b/pkgs/applications/virtualization/vpcs/default.nix index 33d707a5007..8c41a1f4c27 100644 --- a/pkgs/applications/virtualization/vpcs/default.nix +++ b/pkgs/applications/virtualization/vpcs/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { buildPhase = ''( cd src - ./mk.sh ${stdenv.buildPlatform.platform.kernelArch} + ./mk.sh ${stdenv.buildPlatform.linuxArch} )''; installPhase = '' diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index bd3ebdf800e..e0d43739668 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -190,7 +190,7 @@ stdenv.mkDerivation { else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" - else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); + else targetPlatform.bfdEmulation or (fmt + sep + arch); strictDeps = true; depsTargetTargetPropagated = extraPackages; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d1d5f8e6c86..e0153ffc17f 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -402,32 +402,32 @@ stdenv.mkDerivation { # Always add -march based on cpu in triple. Sometimes there is a # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in # that case. - + optionalString ((targetPlatform ? platform.gcc.arch) && - isGccArchSupported targetPlatform.platform.gcc.arch) '' - echo "-march=${targetPlatform.platform.gcc.arch}" >> $out/nix-support/cc-cflags-before + + optionalString ((targetPlatform ? gcc.arch) && + isGccArchSupported targetPlatform.gcc.arch) '' + echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before '' # -mcpu is not very useful. You should use mtune and march # instead. It’s provided here for backwards compatibility. - + optionalString (targetPlatform ? platform.gcc.cpu) '' - echo "-mcpu=${targetPlatform.platform.gcc.cpu}" >> $out/nix-support/cc-cflags-before + + optionalString (targetPlatform ? gcc.cpu) '' + echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before '' # -mfloat-abi only matters on arm32 but we set it here # unconditionally just in case. If the abi specifically sets hard # vs. soft floats we use it here. - + optionalString (targetPlatform ? platform.gcc.float-abi) '' - echo "-mfloat-abi=${targetPlatform.platform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before + + optionalString (targetPlatform ? gcc.float-abi) '' + echo "-mfloat-abi=${targetPlatform.gcc.float-abi}" >> $out/nix-support/cc-cflags-before '' - + optionalString (targetPlatform ? platform.gcc.fpu) '' - echo "-mfpu=${targetPlatform.platform.gcc.fpu}" >> $out/nix-support/cc-cflags-before + + optionalString (targetPlatform ? gcc.fpu) '' + echo "-mfpu=${targetPlatform.gcc.fpu}" >> $out/nix-support/cc-cflags-before '' - + optionalString (targetPlatform ? platform.gcc.mode) '' - echo "-mmode=${targetPlatform.platform.gcc.mode}" >> $out/nix-support/cc-cflags-before + + optionalString (targetPlatform ? gcc.mode) '' + echo "-mmode=${targetPlatform.gcc.mode}" >> $out/nix-support/cc-cflags-before '' - + optionalString (targetPlatform ? platform.gcc.tune && - isGccArchSupported targetPlatform.platform.gcc.tune) '' - echo "-mtune=${targetPlatform.platform.gcc.tune}" >> $out/nix-support/cc-cflags-before + + optionalString (targetPlatform ? gcc.tune && + isGccArchSupported targetPlatform.gcc.tune) '' + echo "-mtune=${targetPlatform.gcc.tune}" >> $out/nix-support/cc-cflags-before '' # TODO: categorize these and figure out a better place for them diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix index 901eb311a88..9af40d33242 100644 --- a/pkgs/build-support/kernel/make-initrd.nix +++ b/pkgs/build-support/kernel/make-initrd.nix @@ -56,13 +56,13 @@ in , prepend ? [] # Whether to wrap the initramfs in a u-boot image. -, makeUInitrd ? stdenvNoCC.hostPlatform.platform.kernelTarget == "uImage" +, makeUInitrd ? stdenvNoCC.hostPlatform.linux-kernel.target == "uImage" # If generating a u-boot image, the architecture to use. The default # guess may not align with u-boot's nomenclature correctly, so it can # be overridden. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list. -, uInitrdArch ? stdenvNoCC.hostPlatform.kernelArch +, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch # The name of the compression, as recognised by u-boot. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list. diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 5f3c7e1d621..215782368f6 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -1,6 +1,6 @@ { pkgs , kernel ? pkgs.linux -, img ? pkgs.stdenv.hostPlatform.platform.kernelTarget +, img ? pkgs.stdenv.hostPlatform.linux-kernel.target , storeDir ? builtins.storeDir , rootModules ? [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" ] diff --git a/pkgs/development/compilers/gcc/common/platform-flags.nix b/pkgs/development/compilers/gcc/common/platform-flags.nix index f3cdce41193..66af8c4a4cc 100644 --- a/pkgs/development/compilers/gcc/common/platform-flags.nix +++ b/pkgs/development/compilers/gcc/common/platform-flags.nix @@ -1,7 +1,7 @@ { lib, targetPlatform }: let - p = targetPlatform.platform.gcc or {} + p = targetPlatform.gcc or {} // targetPlatform.parsed.abi; in lib.concatLists [ (lib.optional (!targetPlatform.isx86_64 && p ? arch) "--with-arch=${p.arch}") # --with-arch= is unknown flag on x86_64 diff --git a/pkgs/development/compilers/julia/1.0.nix b/pkgs/development/compilers/julia/1.0.nix index 0325632ad0a..78f7c2ef1b9 100644 --- a/pkgs/development/compilers/julia/1.0.nix +++ b/pkgs/development/compilers/julia/1.0.nix @@ -123,7 +123,7 @@ stdenv.mkDerivation rec { let arch = stdenv.lib.head (stdenv.lib.splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.3.nix b/pkgs/development/compilers/julia/1.3.nix index 8096af0b320..2a270b7c72c 100644 --- a/pkgs/development/compilers/julia/1.3.nix +++ b/pkgs/development/compilers/julia/1.3.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/compilers/julia/1.5.nix b/pkgs/development/compilers/julia/1.5.nix index be3cfc39635..778a9c3a9d7 100644 --- a/pkgs/development/compilers/julia/1.5.nix +++ b/pkgs/development/compilers/julia/1.5.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { let arch = head (splitString "-" stdenv.system); march = { - x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64"; + x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64"; i686 = "pentium4"; aarch64 = "armv8-a"; }.${arch} diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 6b17e463d76..6637a9bb2a3 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -158,7 +158,7 @@ stdenv.mkDerivation ({ "--enable-kernel=3.2.0" # can't get below with glibc >= 2.26 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ (lib.flip lib.withFeature "fp" - (stdenv.hostPlatform.platform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) + (stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft")) "--with-__thread" ] ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.isAarch32) [ "--host=arm-linux-gnueabi" diff --git a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix index e6ab23073b1..1a3f1948f84 100644 --- a/pkgs/development/libraries/qt-5/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-5/modules/qtwebengine.nix @@ -88,7 +88,7 @@ qtModule { NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit "-Wno-class-memaccess" - ] ++ lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [ + ] ++ lib.optionals (stdenv.hostPlatform.gcc.arch or "" == "sandybridge") [ # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940 # TODO: investigate and fix properly "-march=westmere" diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix index e333bd49718..edf556377b3 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix @@ -73,9 +73,9 @@ let if isLinux then ( - x: x.platform == "manylinux1_${stdenv.platform.kernelArch}" - || x.platform == "manylinux2010_${stdenv.platform.kernelArch}" - || x.platform == "manylinux2014_${stdenv.platform.kernelArch}" + x: x.platform == "manylinux1_${stdenv.hostPlatform.linuxArch}" + || x.platform == "manylinux2010_${stdenv.hostPlatform.linuxArch}" + || x.platform == "manylinux2014_${stdenv.hostPlatform.linuxArch}" || x.platform == "any" ) else (x: hasInfix "macosx" x.platform || x.platform == "any"); diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix index ba8145398f5..ea2f27b0e22 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix @@ -95,7 +95,7 @@ let else if stdenv.isDarwin then "darwin" else throw "Unsupported platform" ); - platform_machine = stdenv.platform.kernelArch; + platform_machine = stdenv.hostPlatform.linuxArch; platform_python_implementation = let impl = python.passthru.implementation; diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index 5308149c26b..ccea8ee4553 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -60,18 +60,17 @@ in configureFlags = let isCross = stdenv.hostPlatform != stdenv.buildPlatform; - host = stdenv.hostPlatform.platform; - isAarch32 = stdenv.hostPlatform.isAarch32; + inherit (stdenv.hostPlatform) gcc isArch32; in sharedConfigureFlags ++ [ "--without-dtrace" ] ++ (optionals isCross [ "--cross-compiling" "--without-intl" "--without-snapshot" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" host.gcc) [ - "--with-arm-fpu=${host.gcc.fpu}" - ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" host.gcc) [ - "--with-arm-float-abi=${host.gcc.float-abi}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [ + "--with-arm-fpu=${gcc.fpu}" + ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [ + "--with-arm-float-abi=${gcc.float-abi}" ]) ++ (optionals (isCross && isAarch32) [ "--dest-cpu=arm" ]) ++ extraConfigFlags; diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix index 88792346d70..958bcdb9f16 100644 --- a/pkgs/os-specific/linux/exfat/default.nix +++ b/pkgs/os-specific/linux/exfat/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { makeFlags = [ "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index cadf65a7220..d6ed7bccba3 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -7,7 +7,7 @@ let pname = "linux-headers"; inherit version; - ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch; + ARCH = stdenvNoCC.hostPlatform.linuxArch; # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc. # We do this so we have a build->build, not build->host, C compiler. diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 31a90dc740f..ac9d6fbb2b5 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -42,7 +42,7 @@ # symbolic name and `patch' is the actual patch. The patch may # optionally be compressed with gzip or bzip2. kernelPatches ? [] -, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" || +, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc" || stdenv.hostPlatform != stdenv.buildPlatform , extraMeta ? {} @@ -51,10 +51,10 @@ , isLibre ? false , isHardened ? false -# easy overrides to stdenv.hostPlatform.platform members -, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules -, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false -, kernelArch ? stdenv.hostPlatform.platform.kernelArch +# easy overrides to stdenv.hostPlatform.linux-kernel members +, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules +, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false +, kernelArch ? stdenv.hostPlatform.linuxArch , ... }: @@ -87,7 +87,7 @@ let intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig # extra config in legacy string format + extraConfig - + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig; + + stdenv.hostPlatform.linux-kernel.extraConfig or ""; structuredConfigFromPatches = map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches; @@ -113,11 +113,11 @@ let nativeBuildInputs = [ perl gmp libmpc mpfr ] ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ]; - platformName = stdenv.hostPlatform.platform.name; + platformName = stdenv.hostPlatform.linux-kernel.name; # e.g. "defconfig" - kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig; + kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig; # e.g. "bzImage" - kernelTarget = stdenv.hostPlatform.platform.kernelTarget; + kernelTarget = stdenv.hostPlatform.linux-kernel.target; prePatch = kernel.prePatch + '' # Patch kconfig to print "###" after every question so that diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 67016b71918..2fc63322f5b 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -64,10 +64,10 @@ let commonMakeFlags = [ "O=$(buildRoot)" - ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags) - stdenv.hostPlatform.platform.kernelMakeFlags; + ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags) + stdenv.hostPlatform.linux-kernel.makeFlags; - drvAttrs = config_: platform: kernelPatches: configfile: + drvAttrs = config_: kernelConf: kernelPatches: configfile: let config = let attrName = attr: "CONFIG_" + attr; in { isSet = attr: hasAttr (attrName attr) config; @@ -171,7 +171,7 @@ let buildFlags = [ "KBUILD_BUILD_VERSION=1-NixOS" - platform.kernelTarget + kernelConf.target "vmlinux" # for "perf" and things like that ] ++ optional isModular "modules"; @@ -186,16 +186,16 @@ let ''; # Some image types need special install targets (e.g. uImage is installed with make uinstall) - installTargets = [ ( - if platform ? kernelInstallTarget then platform.kernelInstallTarget - else if platform.kernelTarget == "uImage" then "uinstall" - else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall" - else "install" - ) ]; + installTargets = [ + (kernelConf.installTarget or ( + /**/ if kernelConf.target == "uImage" then "uinstall" + else if kernelConf.target == "zImage" || kernelConf.target == "Image.gz" then "zinstall" + else "install")) + ]; postInstall = (optionalString installsFirmware '' mkdir -p $out/lib/firmware - '') + (if (platform ? kernelDTB && platform.kernelDTB) then '' + '') + (if (kernelConf.DTB or false) then '' make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs '' else "") + (if isModular then '' mkdir -p $dev @@ -300,7 +300,7 @@ in assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null; assert lib.versionAtLeast version "5.8" -> elfutils != null; -stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // { +stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // { pname = "linux"; inherit version; @@ -308,7 +308,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ] - ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools + ++ optional (stdenv.hostPlatform.linux-kernel.target == "uImage") buildPackages.ubootTools ++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf # Removed util-linuxMinimal since it should not be a dependency. ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ] @@ -322,10 +322,10 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches makeFlags = commonMakeFlags ++ [ "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; - karch = stdenv.hostPlatform.platform.kernelArch; + karch = stdenv.hostPlatform.linuxArch; }) diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix index 65ab71bd562..dc96f3b6a62 100644 --- a/pkgs/os-specific/linux/klibc/default.nix +++ b/pkgs/os-specific/linux/klibc/default.nix @@ -25,11 +25,11 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" "stackprotector" ]; makeFlags = commonMakeFlags ++ [ - "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}" + "KLIBCARCH=${stdenv.hostPlatform.linuxArch}" "KLIBCKERNELSRC=${linuxHeaders}" ] # TODO(@Ericson2314): We now can get the ABI from # `stdenv.hostPlatform.parsed.abi`, is this still a good idea? - ++ lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y" + ++ lib.optional (stdenv.hostPlatform.linuxArch == "arm") "CONFIG_AEABI=y" ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}"; # Install static binaries as well. diff --git a/pkgs/os-specific/linux/rtl8723bs/default.nix b/pkgs/os-specific/linux/rtl8723bs/default.nix index 056fd40d252..a862b351716 100644 --- a/pkgs/os-specific/linux/rtl8723bs/default.nix +++ b/pkgs/os-specific/linux/rtl8723bs/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { buildInputs = [ nukeReferences ]; makeFlags = [ - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. + "ARCH=${stdenv.hostPlatform.linuxArch}" # Normally not needed, but the Makefile sets ARCH in a broken way. "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us. ]; diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix index aeed87d3c19..68a88fb6778 100644 --- a/pkgs/os-specific/linux/rtl8812au/default.nix +++ b/pkgs/os-specific/linux/rtl8812au/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { ''; makeFlags = [ - "ARCH=${stdenv.hostPlatform.platform.kernelArch}" + "ARCH=${stdenv.hostPlatform.linuxArch}" "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n")) ("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n")) diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix index 7c95a98372d..7508e1faf15 100644 --- a/pkgs/os-specific/linux/uclibc/default.nix +++ b/pkgs/os-specific/linux/uclibc/default.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation { cat << EOF | parseconfig ${nixConfig} ${extraConfig} - ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""} + ${stdenv.hostPlatform.uclibc.extraConfig or ""} EOF ( set +o pipefail; yes "" | make oldconfig ) ''; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 0eb799e4525..28d22a4bb47 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -278,8 +278,8 @@ in rec { enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; - } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? platform.gcc.arch) { - requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.platform.gcc.arch}" ]; + } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) { + requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ]; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { inherit __darwinAllowLocalNetworking; # TODO: remove lib.unique once nix has a list canonicalization primitive diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bd86fed4cb2..ed9f3047969 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19291,7 +19291,7 @@ in buildPhase = '' set -x make \ - ARCH=${stdenv.hostPlatform.kernelArch} \ + ARCH=${stdenv.hostPlatform.linuxArch} \ HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \ ${makeTarget} ''; -- cgit 1.4.1 From 8baac2af752450b20cb8b37520059ecd86490b8b Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 25 Jan 2021 17:55:04 -0800 Subject: lib/systems: fix linuxArch for power + riscv Looks like these got left behind in the kernelArch -> linuxArch migration. Fixes: * pkgsCross.powernv.linuxHeaders * pkgsCross.riscv64.linuxHeaders * pkgsCross.riscv32.linuxHeaders and dependees --- lib/systems/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 1a89120e2bf..1bbe976c4d2 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -92,6 +92,8 @@ rec { else if final.isx86_32 then "i386" else if final.isx86_64 then "x86_64" else if final.isMips then "mips" + else if final.isPower then "powerpc" + else if final.isRiscV then "riscv" else final.parsed.cpu.name; qemuArch = -- cgit 1.4.1 From 75e2f7ce6385bdb7097db942d1df4f20dfc90463 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Fri, 29 Jan 2021 09:59:40 +0100 Subject: gcc: fix armhf target Fixes #96921 --- lib/systems/examples.nix | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index e8cf15479c0..be87fb1d069 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -131,6 +131,12 @@ rec { armhf-embedded = { config = "arm-none-eabihf"; libc = "newlib"; + # GCC8+ does not build without this + # (https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg552339.html): + gcc = { + arch = "armv5t"; + fpu = "vfp"; + }; }; aarch64-embedded = { -- cgit 1.4.1 From 72b3badb6197a042c52397fcea467f630628c75c Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 29 Jan 2021 19:23:04 -0800 Subject: lib.systems: add powerpc64-linux PPC64 supports two ABIs: ELF v1 and v2. ELFv1 is historically what GCC and most packages expect, but this is changing because musl outright does not work with ELFv1. So any distro which uses musl must use ELFv2. Many other platforms are moving to ELFv2 too, such as FreeBSD (as of v13) and Gentoo (as of late 2020). Since we use musl extensively, let's default to ELFv2. Nix gives us the power to specify this declaratively for the entire system, so ELFv1 is not dropped entirely. It can be specified explicitly in the target config, e.g. "powerpc64-unknown-linux-elfv1". Otherwise the default is "powerpc64-unknown-linux-elfv2". For musl, "powerpc64-unknown-linux-musl" must use elfv2 internally to function. --- lib/systems/doubles.nix | 5 +++-- lib/systems/examples.nix | 13 +++++++++++++ lib/systems/parse.nix | 9 +++++++++ lib/tests/systems.nix | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index b0bc7dd1188..07327fa2273 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -24,6 +24,7 @@ let "x86_64-redox" + "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" @@ -72,7 +73,7 @@ in { darwin = filterDoubles predicates.isDarwin; freebsd = filterDoubles predicates.isFreeBSD; # Should be better, but MinGW is unclear. - gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }); + gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv1; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv2; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; @@ -85,5 +86,5 @@ in { embedded = filterDoubles predicates.isNone; - mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64le-linux"]; + mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux"]; } diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index e8cf15479c0..fbb697f1fe1 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -21,6 +21,19 @@ rec { config = "powerpc64le-unknown-linux-musl"; }; + ppc64-elfv1 = { + config = "powerpc64-unknown-linux-elfv1"; + }; + ppc64-elfv2 = { + config = "powerpc64-unknown-linux-elfv2"; + }; + ppc64 = ppc64-elfv2; # default to modern elfv2 + + ppc64-musl = { + config = "powerpc64-unknown-linux-musl"; + gcc = { abi = "elfv2"; }; # for gcc configuration + }; + sheevaplug = { config = "armv5tel-unknown-linux-gnueabi"; } // platforms.sheevaplug; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index a06ac0d11f7..8e012622ccd 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -337,10 +337,18 @@ rec { The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead. ''; } + { assertion = platform: platform.system != "powerpc64-linux"; + message = '' + The "gnu" ABI is ambiguous on big-endian 64-bit PPC. Use "elfv1" or "elfv2" instead. + ''; + } ]; }; gnuabi64 = { abi = "64"; }; + elfv1 = { abi = "elfv1"; }; + elfv2 = { abi = "elfv2"; }; + musleabi = { float = "soft"; }; musleabihf = { float = "hard"; }; musl = {}; @@ -444,6 +452,7 @@ rec { if lib.versionAtLeast (parsed.cpu.version or "0") "6" then abis.gnueabihf else abis.gnueabi + else if cpu == "powerpc64" then abis.elfv2 else abis.gnu else abis.unknown; }; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index eed7ee725bc..c0800df25ed 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests { testredox = mseteq redox [ "x86_64-redox" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; - testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64le-linux" ]; + testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" ]; testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; -- cgit 1.4.1 From 408ae0b13a2698925a822532b4effdf8d0abf1a6 Mon Sep 17 00:00:00 2001 From: Philipp Adolf Date: Thu, 11 Feb 2021 08:49:08 +0100 Subject: lib: fix typo in platforms.nix In 9c213398b312e0f0bb9cdf05090fd20223a82ad0 kernelPreferBuiltin was moved/renamed to linux-kernel.preferBuiltin. However, for armv7l-hf-multiplatform the new option was written with an uppercase P, which made the kernel build process ignore it. --- lib/systems/platforms.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index f399c1873f5..3bf90cd0caf 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -300,7 +300,7 @@ rec { baseConfig = "multi_v7_defconfig"; DTB = true; autoModules = true; - PreferBuiltin = true; + preferBuiltin = true; target = "zImage"; extraConfig = '' # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. -- cgit 1.4.1 From 1e1588898bcfe819111477f4b9c339178cd5f95d Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sat, 6 Feb 2021 12:34:48 -0500 Subject: lib/systems/platforms: note that RPi 3 fixes aren't needed for kernel >=4.17 --- lib/systems/platforms.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 3bf90cd0caf..12d4f7f9d78 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -303,7 +303,8 @@ rec { preferBuiltin = true; target = "zImage"; extraConfig = '' - # Serial port for Raspberry Pi 3. Upstream forgot to add it to the ARMv7 defconfig. + # Serial port for Raspberry Pi 3. Wasn't included in ARMv7 defconfig + # until 4.17. SERIAL_8250_BCM2835AUX y SERIAL_8250_EXTENDED y SERIAL_8250_SHARE_IRQ y -- cgit 1.4.1 From 7b573e80516d77cb7ece1dcc969e5f35f6e79e74 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sat, 6 Feb 2021 12:36:28 -0500 Subject: lib/systems/platforms: remove TI_CPTS override Forcing the module to be builtin breaks 5.10, which wants to compile it as a module (probably due to dependencies). There doesn't seem to be a need to have it builtin anymore, so we can just remove the override. --- lib/systems/platforms.nix | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 12d4f7f9d78..f46e9c826a5 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -309,9 +309,6 @@ rec { SERIAL_8250_EXTENDED y SERIAL_8250_SHARE_IRQ y - # Fix broken sunxi-sid nvmem driver. - TI_CPTS y - # Hangs ODROID-XU4 ARM_BIG_LITTLE_CPUIDLE n -- cgit 1.4.1 From 1303257d8826681b7c0c122b38bb5bd4a1002aa7 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 11 Dec 2020 20:15:34 +0900 Subject: lib/systems: add `darwinArch` --- lib/systems/default.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 1bbe976c4d2..1e38dbf531b 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -107,6 +107,11 @@ rec { powerpc64le = "ppc64le"; }.${final.parsed.cpu.name} or final.parsed.cpu.name; + darwinArch = { + armv7a = "armv7"; + aarch64 = "arm64"; + }.${final.parsed.cpu.name} or final.parsed.cpu.name; + emulator = pkgs: let qemu-user = pkgs.qemu.override { smartcardSupport = false; -- cgit 1.4.1 From 8ea1660b9e45f36d597af201b0f752478388ca66 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 15 Mar 2021 19:22:57 -0700 Subject: lib/systems: remove powerpc64 elfv1 support I was specifying the ELF ABI using -elfv1 and -elfv2 target config suffixes, which are nonstandard and no longer work with gnu-config. --- lib/systems/doubles.nix | 2 +- lib/systems/examples.nix | 10 +++------- lib/systems/parse.nix | 9 --------- 3 files changed, 4 insertions(+), 17 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 07327fa2273..8220bca249f 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -73,7 +73,7 @@ in { darwin = filterDoubles predicates.isDarwin; freebsd = filterDoubles predicates.isFreeBSD; # Should be better, but MinGW is unclear. - gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv1; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.elfv2; }); + gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 8a43b86db70..81dc893871d 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -21,14 +21,10 @@ rec { config = "powerpc64le-unknown-linux-musl"; }; - ppc64-elfv1 = { - config = "powerpc64-unknown-linux-elfv1"; - }; - ppc64-elfv2 = { - config = "powerpc64-unknown-linux-elfv2"; + ppc64 = { + config = "powerpc64-unknown-linux-gnu"; + gcc = { abi = "elfv2"; }; # for gcc configuration }; - ppc64 = ppc64-elfv2; # default to modern elfv2 - ppc64-musl = { config = "powerpc64-unknown-linux-musl"; gcc = { abi = "elfv2"; }; # for gcc configuration diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 8e012622ccd..a06ac0d11f7 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -337,18 +337,10 @@ rec { The "gnu" ABI is ambiguous on 32-bit ARM. Use "gnueabi" or "gnueabihf" instead. ''; } - { assertion = platform: platform.system != "powerpc64-linux"; - message = '' - The "gnu" ABI is ambiguous on big-endian 64-bit PPC. Use "elfv1" or "elfv2" instead. - ''; - } ]; }; gnuabi64 = { abi = "64"; }; - elfv1 = { abi = "elfv1"; }; - elfv2 = { abi = "elfv2"; }; - musleabi = { float = "soft"; }; musleabihf = { float = "hard"; }; musl = {}; @@ -452,7 +444,6 @@ rec { if lib.versionAtLeast (parsed.cpu.version or "0") "6" then abis.gnueabihf else abis.gnueabi - else if cpu == "powerpc64" then abis.elfv2 else abis.gnu else abis.unknown; }; -- cgit 1.4.1 From 44f09ccabf645d1f079f71b541d7f1ac0a6b8848 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Fri, 5 Feb 2021 16:24:43 +0900 Subject: darwin: move deployment target and sdk version to platform config --- lib/systems/default.nix | 9 +++++++++ pkgs/development/tools/xcbuild/wrapper.nix | 2 +- pkgs/stdenv/darwin/default.nix | 9 +-------- pkgs/stdenv/generic/default.nix | 2 ++ 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 1e38dbf531b..d16b19c03ca 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -112,6 +112,15 @@ rec { aarch64 = "arm64"; }.${final.parsed.cpu.name} or final.parsed.cpu.name; + darwinPlatform = + if final.isMacOS then "macos" + else if final.isiOS then "ios" + else null; + # The canonical name for this attribute is darwinSdkVersion, but some + # platforms define the old name "sdkVer". + darwinSdkVersion = final.sdkVer or "10.12"; + darwinMinVersion = final.darwinSdkVersion; + emulator = pkgs: let qemu-user = pkgs.qemu.override { smartcardSupport = false; diff --git a/pkgs/development/tools/xcbuild/wrapper.nix b/pkgs/development/tools/xcbuild/wrapper.nix index 861ef0fc847..4f74b093717 100644 --- a/pkgs/development/tools/xcbuild/wrapper.nix +++ b/pkgs/development/tools/xcbuild/wrapper.nix @@ -3,7 +3,7 @@ , runtimeShell, callPackage , xcodePlatform ? stdenv.targetPlatform.xcodePlatform or "MacOSX" , xcodeVer ? stdenv.targetPlatform.xcodeVer or "9.4.1" -, sdkVer ? stdenv.targetPlatform.sdkVer or "10.12" }: +, sdkVer ? stdenv.targetPlatform.darwinSdkVersion or "10.12" }: let diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index a7b91a82a9d..e8b3ef6c10f 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1,7 +1,5 @@ { lib , localSystem, crossSystem, config, overlays, crossOverlays ? [] -# Minimum required macOS version, used both for compatibility as well as reproducability. -, macosVersionMin ? "10.12" # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools , bootstrapFiles ? let fetch = { file, sha256, executable ? true }: import { @@ -36,8 +34,6 @@ in rec { export NIX_IGNORE_LD_THROUGH_GCC=1 unset SDKROOT - export MACOSX_DEPLOYMENT_TARGET=${macosVersionMin} - # Workaround for https://openradar.appspot.com/22671534 on 10.11. export gl_cv_func_getcwd_abort_bug=no @@ -147,9 +143,6 @@ in rec { __stdenvImpureHostDeps = commonImpureHostDeps; __extraImpureHostDeps = commonImpureHostDeps; - extraAttrs = { - inherit macosVersionMin; - }; overrides = self: super: (overrides self super) // { inherit ccNoLibcxx; fetchurl = thisStdenv.fetchurlBoot; @@ -523,7 +516,7 @@ in rec { extraAttrs = { libc = pkgs.darwin.Libsystem; shellPackage = pkgs.bash; - inherit macosVersionMin bootstrapTools; + inherit bootstrapTools; }; allowedRequisites = (with pkgs; [ diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 476fab3eed6..8ab9d734461 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -106,6 +106,8 @@ let '' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) '' export NIX_DONT_SET_RPATH=1 export NIX_NO_SELF_RPATH=1 + '' + lib.optionalString (hostPlatform.isDarwin && hostPlatform.isMacOS) '' + export MACOSX_DEPLOYMENT_TARGET=${hostPlatform.darwinMinVersion} '' # TODO this should be uncommented, but it causes stupid mass rebuilds. I # think the best solution would just be to fixup linux RPATHs so we don't -- cgit 1.4.1 From 5f7aa7a97357f932e88b1667435317528e2b661e Mon Sep 17 00:00:00 2001 From: Milan Pässler Date: Fri, 9 Apr 2021 09:17:54 +0200 Subject: systems: add appropriate rustc.config for android Rust doesn't like the `-unknown` vendor component in the target triple. --- lib/systems/examples.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 8a43b86db70..389c4eebcc8 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -60,6 +60,7 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; + rustc.config = "armv7-linux-androideabi"; sdkVer = "29"; ndkVer = "21"; useAndroidPrebuilt = true; @@ -67,6 +68,7 @@ rec { aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; + rustc.config = "aarch64-linux-android"; sdkVer = "29"; ndkVer = "21"; useAndroidPrebuilt = true; -- cgit 1.4.1 From 6c4ce7960ebcd5559bedb68bef4acf32b44321d1 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Sat, 10 Apr 2021 18:06:25 +0900 Subject: bintools-wrapper, cc-wrapper: parameterize darwin min version variable These variables are the ones that the standard toolchain uses, so we should use those and not always use MACOSX_DEPLOYMENT_TARGET. See https://github.com/tpoechtrager/cctools-port/blob/236a426c1205a3bfcf0dbb2e2faf2296f0a100e5/cctools/ld64/src/ld/PlatformSupport.cpp#L54-L55 --- lib/systems/default.nix | 4 ++++ pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh | 6 +++--- pkgs/build-support/bintools-wrapper/default.nix | 5 ++++- pkgs/build-support/cc-wrapper/add-flags.sh | 4 ++-- pkgs/build-support/cc-wrapper/default.nix | 5 ++++- 5 files changed, 17 insertions(+), 7 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index d16b19c03ca..21b00374da4 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -120,6 +120,10 @@ rec { # platforms define the old name "sdkVer". darwinSdkVersion = final.sdkVer or "10.12"; darwinMinVersion = final.darwinSdkVersion; + darwinMinVersionVariable = + if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET" + else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET" + else null; emulator = pkgs: let qemu-user = pkgs.qemu.override { diff --git a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh index 318311e1be9..bd3edda3f2e 100644 --- a/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh +++ b/pkgs/build-support/bintools-wrapper/add-darwin-ldflags-before.sh @@ -21,7 +21,7 @@ havePlatformVersionFlag= haveDarwinSDKVersion= haveDarwinPlatformVersion= -mangleVarSingle MACOSX_DEPLOYMENT_TARGET ${role_suffixes[@]+"${role_suffixes[@]}"} +mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"} n=0 nParams=${#params[@]} @@ -61,12 +61,12 @@ done if [ ! "$havePlatformVersionFlag" ]; then if [ ! "$haveDarwinSDKVersion" ] && [ ! "$haveDarwinPlatformVersion" ]; then # Nothing provided. Use the modern "-platform_version" to set both. - extraBefore+=(-platform_version @darwinPlatform@ "${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@}" @darwinSdkVersion@) + extraBefore+=(-platform_version @darwinPlatform@ "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}" @darwinSdkVersion@) elif [ ! "$haveDarwinSDKVersion" ]; then # Add missing sdk version extraBefore+=(-sdk_version @darwinSdkVersion@) elif [ ! "$haveDarwinPlatformVersion" ]; then # Add missing platform version - extraBefore+=(-@darwinPlatform@_version_min "${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@}") + extraBefore+=(-@darwinPlatform@_version_min "${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@}") fi fi diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 77185e800e3..859e3790594 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -327,11 +327,14 @@ stdenv.mkDerivation { ### + optionalString stdenv.targetPlatform.isDarwin ( let - inherit (stdenv.targetPlatform) darwinMinVersion darwinPlatform darwinSdkVersion; + inherit (stdenv.targetPlatform) + darwinPlatform darwinSdkVersion + darwinMinVersion darwinMinVersionVariable; in '' export darwinPlatform=${darwinPlatform} export darwinMinVersion=${darwinMinVersion} export darwinSdkVersion=${darwinSdkVersion} + export darwinMinVersionVariable=${darwinMinVersionVariable} substituteAll ${./add-darwin-ldflags-before.sh} $out/nix-support/add-local-ldflags-before.sh '' ) diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index f7276b04e54..a6e991914e6 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -68,9 +68,9 @@ fi # Only add darwin min version flag if a default darwin min version is set, # which is a signal that we're targetting darwin. if [ "@darwinMinVersion@" ]; then - mangleVarSingle MACOSX_DEPLOYMENT_TARGET ${role_suffixes[@]+"${role_suffixes[@]}"} + mangleVarSingle @darwinMinVersionVariable@ ${role_suffixes[@]+"${role_suffixes[@]}"} - NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${MACOSX_DEPLOYMENT_TARGET_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@" + NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="-m@darwinPlatformForCC@-version-min=${@darwinMinVersionVariable@_@suffixSalt@:-@darwinMinVersion@} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@" fi # That way forked processes will not extend these environment variables again. diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 834c4e6d46a..db751593701 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -109,6 +109,9 @@ let darwinMinVersion = optionalString stdenv.targetPlatform.isDarwin ( stdenv.targetPlatform.darwinMinVersion ); + + darwinMinVersionVariable = optionalString stdenv.targetPlatform.isDarwin + stdenv.targetPlatform.darwinMinVersionVariable; in # Ensure bintools matches @@ -131,7 +134,7 @@ stdenv.mkDerivation { gnugrep_bin = if nativeTools then "" else gnugrep; inherit targetPrefix suffixSalt; - inherit darwinPlatformForCC darwinMinVersion; + inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ]; -- cgit 1.4.1 From d0418480f1191167b0416dc3482c90ccd604d9bf Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Sat, 10 Apr 2021 18:11:16 +0900 Subject: lib.systems: add darwinPlatform where necessary --- lib/systems/examples.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 8a43b86db70..082be8902bb 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -219,6 +219,7 @@ rec { sdkVer = "14.3"; xcodeVer = "12.3"; xcodePlatform = "iPhoneSimulator"; + darwinPlatform = "ios-simulator"; useiOSPrebuilt = true; }; @@ -228,6 +229,7 @@ rec { sdkVer = "14.3"; xcodeVer = "12.3"; xcodePlatform = "iPhoneSimulator"; + darwinPlatform = "ios-simulator"; useiOSPrebuilt = true; }; -- cgit 1.4.1 From a2650e125701ab20730bb79ab28072c749919a51 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 19 May 2020 21:57:03 -0400 Subject: lib: Adjust NetBSD example systems Deprecate the odd one so no breaking change. --- lib/systems/examples.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 838b648e582..654d6f69af0 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -248,9 +248,18 @@ rec { # BSDs - amd64-netbsd = { + # Deprecate + amd64-netbsd = x86_64-netbsd; + + x86_64-netbsd = { + config = "x86_64-unknown-netbsd"; + libc = "nblibc"; + }; + + x86_64-netbsd-llvm = { config = "x86_64-unknown-netbsd"; libc = "nblibc"; + useLLVM = true; }; # -- cgit 1.4.1 From 9767460d0067d824a4e5071ba0e490e54b1d4939 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 15 Apr 2021 09:18:08 +0000 Subject: lib.systems.examples.amd64-netbsd: add warning Otherwise, nobody will know it's deprecated! --- lib/systems/examples.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 654d6f69af0..f5cba8bcd63 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -248,8 +248,7 @@ rec { # BSDs - # Deprecate - amd64-netbsd = x86_64-netbsd; + amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd; x86_64-netbsd = { config = "x86_64-unknown-netbsd"; -- cgit 1.4.1 From cf5d480a06a335f40a4ea42f1c739981b6e2ee34 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 18 Apr 2021 22:25:54 +0000 Subject: lib.systems.doubles.all: reorganize The previous mess was partially grouped by OS, and partially grouped by architecture, which made it very difficult to know where to add new entries. I've chosen to group by OS entirely, because OSes are likely to maintain exhaustive lists of supported architectures, but it's far less likely we'd be able to find exhaustive lists of supported OSes for every architecture. --- lib/systems/doubles.nix | 56 ++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 8220bca249f..7ad40c8c62c 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -6,43 +6,51 @@ let inherit (lib.attrsets) matchAttrs; all = [ - "aarch64-linux" - "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" + # Cygwin + "i686-cygwin" "x86_64-cygwin" - "mipsel-linux" + # Darwin + "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" - "i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd" + # FreeBSD + "i686-freebsd" "x86_64-freebsd" - "x86_64-cygwin" "x86_64-freebsd" "x86_64-linux" - "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris" + # Genode + "aarch64-genode" "i686-genode" "x86_64-genode" - "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" + # illumos + "x86_64-solaris" - "x86_64-windows" "i686-windows" + # JS + "js-ghcjs" - "wasm64-wasi" "wasm32-wasi" + # Linux + "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" + "armv7l-linux" "i686-linux" "mipsel-linux" "powerpc64-linux" + "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" - "x86_64-redox" + # MMIXware + "mmix-mmixware" - "powerpc64-linux" - "powerpc64le-linux" + # NetBSD + "i686-netbsd" "x86_64-netbsd" - "riscv32-linux" "riscv64-linux" + # none + "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" + "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" + "x86_64-none" - "arm-none" "armv6l-none" "aarch64-none" - "avr-none" - "i686-none" "x86_64-none" - "powerpc-none" - "msp430-none" - "riscv64-none" "riscv32-none" - "vc4-none" - "or1k-none" + # OpenBSD + "i686-openbsd" "x86_64-openbsd" - "mmix-mmixware" + # Redox + "x86_64-redox" - "js-ghcjs" + # WASI + "wasm64-wasi" "wasm32-wasi" - "aarch64-genode" "i686-genode" "x86_64-genode" + # Windows + "x86_64-windows" "i686-windows" ]; allParsed = map parse.mkSystemFromString all; -- cgit 1.4.1 From 532493b50893e463e8bb3c76641cb4d31c7c3835 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 18 Apr 2021 22:53:35 +0000 Subject: lib.systems.doubles.netbsd: expand These are all the architectures supported by Nixpkgs on other platforms, that are also supported by NetBSD. (So I haven't added any architectures that are new to Nixpkgs here, even though NetBSD supports some that we don't have.) --- lib/systems/doubles.nix | 4 +++- lib/tests/systems.nix | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 7ad40c8c62c..6f638be585b 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -33,7 +33,9 @@ let "mmix-mmixware" # NetBSD - "i686-netbsd" "x86_64-netbsd" + "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" + "i686-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" + "riscv64-netbsd" "x86_64-netbsd" # none "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index c0800df25ed..36f82b783b4 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -15,9 +15,9 @@ in with lib.systems.doubles; lib.runTests { testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox); - testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-none" "armv7a-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ]; + testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ]; testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; - testmips = mseteq mips [ "mipsel-linux" ]; + testmips = mseteq mips [ "mipsel-linux" "mipsel-netbsd" ]; testmmix = mseteq mmix [ "mmix-mmixware" ]; testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; @@ -29,7 +29,7 @@ with lib.systems.doubles; lib.runTests { testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" ]; - testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]; + testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin ++ redox); -- cgit 1.4.1 From 1e1d29c2af646b21c04f7a27614317a19ee01bc5 Mon Sep 17 00:00:00 2001 From: s1341 Date: Thu, 6 May 2021 07:15:34 +0300 Subject: treewide: Support aarch64-android using minimal prebuilt components This PR adds a new aarch64 android toolchain, which leverages the existing crossSystem infrastructure and LLVM builders to generate a working toolchain with minimal prebuilt components. The only thing that is prebuilt is the bionic libc. This is because it is practically impossible to compile bionic outside of an AOSP tree. I tried and failed, braver souls may prevail. For now I just grab the relevant binaries from https://android.googlesource.com/. I also grab the msm kernel sources from there to generate headers. I've included a minor patch to the existing kernel-headers derivation in order to expose an internal function. Everything else, from binutils up, is using stock code. Many thanks to @Ericson2314 for his help on this, and for building such a powerful system in the first place! One motivation for this is to be able to build a toolchain which will work on an aarch64 linux machine. To my knowledge, there is no existing toolchain for an aarch64-linux builder and an aarch64-android target. --- lib/systems/examples.nix | 9 ++ pkgs/build-support/cc-wrapper/default.nix | 4 + .../compilers/llvm/12/compiler-rt/default.nix | 10 +- pkgs/development/compilers/llvm/12/default.nix | 24 ++++- pkgs/os-specific/linux/bionic-prebuilt/default.nix | 113 +++++++++++++++++++++ .../linux/bionic-prebuilt/ndk-version.patch | 42 ++++++++ pkgs/os-specific/linux/kernel-headers/default.nix | 22 +++- pkgs/top-level/all-packages.nix | 10 +- 8 files changed, 222 insertions(+), 12 deletions(-) create mode 100644 pkgs/os-specific/linux/bionic-prebuilt/default.nix create mode 100644 pkgs/os-specific/linux/bionic-prebuilt/ndk-version.patch (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 9c0013c3977..d5f2f2068b4 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -70,6 +70,15 @@ rec { useAndroidPrebuilt = true; }; + aarch64-android = { + config = "aarch64-unknown-linux-android"; + sdkVer = "30"; + ndkVer = "21"; + libc = "bionic"; + useAndroidPrebuilt = false; + useLLVM = true; + }; + scaleway-c1 = armv7l-hf-multiplatform // platforms.scaleway-c1; pogoplug4 = { diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 36a98a180b3..be5c3bca235 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -491,6 +491,10 @@ stdenv.mkDerivation { echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags '' + + optionalString targetPlatform.isAndroid '' + echo "-D__ANDROID_API__=${targetPlatform.sdkVer}" >> $out/nix-support/cc-cflags + '' + # There are a few tools (to name one libstdcxx5) which do not work # well with multi line flags, so make the flags single line again + '' diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix index b880a0071b9..8ca01e44a54 100644 --- a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix @@ -4,14 +4,15 @@ let useLLVM = stdenv.hostPlatform.useLLVM or false; bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; + haveLibc = stdenv.cc.libc != null; inherit (stdenv.hostPlatform) isMusl; in stdenv.mkDerivation rec { - pname = "compiler-rt"; + pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc"; inherit version; - src = fetch pname "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45"; + src = fetch "compiler-rt" "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45"; nativeBuildInputs = [ cmake python3 llvm.dev ]; buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi; @@ -29,14 +30,15 @@ stdenv.mkDerivation rec { "-DCOMPILER_RT_BUILD_XRAY=OFF" "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" "-DCOMPILER_RT_BUILD_PROFILE=OFF" - ] ++ lib.optionals (useLLVM || bareMetal) [ + ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [ "-DCMAKE_C_COMPILER_WORKS=ON" "-DCMAKE_CXX_COMPILER_WORKS=ON" "-DCOMPILER_RT_BAREMETAL_BUILD=ON" "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" + ] ++ lib.optionals (useLLVM && !haveLibc) [ + "-DCMAKE_C_FLAGS=-nodefaultlibs" ] ++ lib.optionals (useLLVM) [ "-DCOMPILER_RT_BUILD_BUILTINS=ON" - "-DCMAKE_C_FLAGS=-nodefaultlibs" #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ lib.optionals (bareMetal) [ diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 33db315f625..57017a9a098 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -131,6 +131,8 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags + '' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) '' + echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands cc; @@ -181,17 +183,37 @@ let '' + mkExtraBuildCommands0 cc; }; + lldClangNoCompilerRtWithLibc = wrapCCWith rec { + cc = tools.clang-unwrapped; + libcxx = null; + bintools = wrapBintoolsWith { + inherit (tools) bintools; + }; + extraPackages = [ ]; + extraBuildCommands = mkExtraBuildCommands0 cc; + }; + }); libraries = lib.makeExtensible (libraries: let callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); in { - compiler-rt = callPackage ./compiler-rt ({ inherit llvm_meta; } // + compiler-rt-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } // + (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc; + })); + + compiler-rt-no-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } // (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; })); + # N.B. condition is safe because without useLLVM both are the same. + compiler-rt = if stdenv.hostPlatform.isAndroid + then libraries.compiler-rt-libc + else libraries.compiler-rt-no-libc; + stdenv = overrideCC stdenv buildLlvmTools.clang; libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang; diff --git a/pkgs/os-specific/linux/bionic-prebuilt/default.nix b/pkgs/os-specific/linux/bionic-prebuilt/default.nix new file mode 100644 index 00000000000..4536067cbf3 --- /dev/null +++ b/pkgs/os-specific/linux/bionic-prebuilt/default.nix @@ -0,0 +1,113 @@ +{ stdenvNoCC, lib, fetchurl, fetchzip, pkgs +}: +let + + prebuilt_crt = fetchzip { + url = "https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/98dce673ad97a9640c5d90bbb1c718e75c21e071/lib/gcc/aarch64-linux-android/4.9.x.tar.gz"; + sha256 = "sha256-LLD2OJi78sNN5NulOsJZl7Ei4F1EUYItGG6eUsKWULc="; + stripRoot = false; + }; + + prebuilt_libs = fetchzip { + url = "https://android.googlesource.com/platform/prebuilts/ndk/+archive/f2c77d8ba8a7f5c2d91771e31164f29be0b8ff98/platform/platforms/android-30/arch-arm64/usr/lib.tar.gz"; + sha256 = "sha256-TZBV7+D1QvKOCEi+VNGT5SStkgj0xRbyWoLH65zSrjw="; + stripRoot = false; + }; + + prebuilt_ndk_crt = fetchzip { + url = "https://android.googlesource.com/toolchain/prebuilts/ndk/r23/+archive/6c5fa4c0d3999b9ee932f6acbd430eb2f31f3151/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/30.tar.gz"; + sha256 = "sha256-KHw+cCwAwlm+5Nwp1o8WONqdi4BBDhFaVVr+7GxQ5uE="; + stripRoot = false; + }; + + ndk_support_headers = fetchzip { + url ="https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+archive/0e7f808fa26cce046f444c9616d9167dafbfb272/clang-r416183b/include/c++/v1/support.tar.gz"; + sha256 = "sha256-NBv7Pk1CEaz8ns9moleEERr3x/rFmVmG33LgFSeO6fY="; + stripRoot = false; + }; + + kernelHeaders = pkgs.makeLinuxHeaders { + version = "android-common-11-5.4"; + src = fetchurl { + url = "https://android.googlesource.com/kernel/common/+archive/48ffcbf0b9e7f0280bfb8c32c68da0aaf0fdfef6.tar.gz"; + sha256 = "0ksm1243zm9hsv0a6q9v15jabf2rivsn14kmnm2qw6zk3mjd4jvv"; + }; + }; + +in +stdenvNoCC.mkDerivation rec { + pname = "bionic-prebuilt"; + version = "ndk-release-r23"; + + src = fetchurl { + url = "https://android.googlesource.com/platform/bionic/+archive/00e8ce1142d8823b0d2fc8a98b40119b0f1f02cd.tar.gz"; + sha256 = "0cfkwdcb2c9nnlmkx0inbsja3cyiha71nj92lm66m5an70zc3b8q"; + }; + + sourceRoot = "."; + + NIX_DONT_SET_RPATH = true; + + dontConfigure = true; + dontBuild = true; + + patches = [ + ./ndk-version.patch + ]; + + postPatch = '' + substituteInPlace libc/include/sys/cdefs.h --replace \ + "__has_builtin(__builtin_umul_overflow)" "1" + substituteInPlace libc/include/bits/ioctl.h --replace \ + "!defined(BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD)" "0" + ''; + + installPhase= '' + # copy the bionic headers + mkdir -p $out/include/support $out/include/android + cp -vr libc/include/* $out/include + # copy the kernel headers + cp -vr ${kernelHeaders}/include/* $out/include/ + + chmod -R +w $out/include/linux + + # fix a bunch of kernel headers so that things can actually be found + sed -i 's,struct epoll_event {,#include \nstruct Xepoll_event {,' $out/include/linux/eventpoll.h + sed -i 's,struct in_addr {,typedef unsigned int in_addr_t;\nstruct in_addr {,' $out/include/linux/in.h + sed -i 's,struct udphdr {,struct Xudphdr {,' $out/include/linux/udp.h + sed -i 's,union semun {,union Xsemun {,' $out/include/linux/sem.h + sed -i 's,struct __kernel_sockaddr_storage,#define sockaddr_storage __kernel_sockaddr_storage\nstruct __kernel_sockaddr_storage,' $out/include/linux/socket.h + sed -i 's,#ifndef __UAPI_DEF_.*$,#if 1,' $out/include/linux/libc-compat.h + substituteInPlace $out/include/linux/in.h --replace "__be32 imr_" "struct in_addr imr_" + substituteInPlace $out/include/linux/in.h --replace "__be32 imsf_" "struct in_addr imsf_" + substituteInPlace $out/include/linux/sysctl.h --replace "__unused" "_unused" + + # what could possibly live in + touch $out/include/linux/compiler.h + + # copy the support headers + cp -vr ${ndk_support_headers}* $out/include/support/ + + mkdir $out/lib + cp -v ${prebuilt_crt.out}/*.o $out/lib/ + cp -v ${prebuilt_crt.out}/libgcc.a $out/lib/ + cp -v ${prebuilt_ndk_crt.out}/*.o $out/lib/ + for i in libc.so libm.so libdl.so liblog.so; do + cp -v ${prebuilt_libs.out}/$i $out/lib/ + done + + mkdir -p $dev/include + cp -v $out/include/*.h $dev/include/ + ''; + + outputs = [ "out" "dev" ]; + passthru.linuxHeaders = kernelHeaders; + + meta = with lib; { + description = "The Android libc implementation"; + homepage = "https://android.googlesource.com/platform/bionic/"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ s1341 ]; + }; +} diff --git a/pkgs/os-specific/linux/bionic-prebuilt/ndk-version.patch b/pkgs/os-specific/linux/bionic-prebuilt/ndk-version.patch new file mode 100644 index 00000000000..a6842ed479f --- /dev/null +++ b/pkgs/os-specific/linux/bionic-prebuilt/ndk-version.patch @@ -0,0 +1,42 @@ +--- a/libc/include/android/ndk-version.h 2021-04-01 16:08:03.109183965 +0300 ++++ b/libc/include/android/ndk-version.h 2021-04-01 16:07:19.811424641 +0300 +@@ -0,0 +1,39 @@ ++#pragma once ++ ++/** ++ * Set to 1 if this is an NDK, unset otherwise. See ++ * https://android.googlesource.com/platform/bionic/+/master/docs/defines.md. ++ */ ++#define __ANDROID_NDK__ 1 ++ ++/** ++ * Major version of this NDK. ++ * ++ * For example: 16 for r16. ++ */ ++#define __NDK_MAJOR__ 22 ++ ++/** ++ * Minor version of this NDK. ++ * ++ * For example: 0 for r16 and 1 for r16b. ++ */ ++#define __NDK_MINOR__ 0 ++ ++/** ++ * Set to 0 if this is a release build, or 1 for beta 1, ++ * 2 for beta 2, and so on. ++ */ ++#define __NDK_BETA__ 0 ++ ++/** ++ * Build number for this NDK. ++ * ++ * For a local development build of the NDK, this is -1. ++ */ ++#define __NDK_BUILD__ 7026061 ++ ++/** ++ * Set to 1 if this is a canary build, 0 if not. ++ */ ++#define __NDK_CANARY__ 0 diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index 34e80ac8222..d9dac5e53a5 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -1,4 +1,9 @@ -{ stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header }: +{ stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header +, bison ? null, flex ? null, python ? null, rsync ? null +}: + +assert stdenvNoCC.hostPlatform.isAndroid -> + (flex != null && bison != null && python != null && rsync != null); let makeLinuxHeaders = { src, version, patches ? [] }: stdenvNoCC.mkDerivation { @@ -13,7 +18,11 @@ let # We do this so we have a build->build, not build->host, C compiler. depsBuildBuild = [ buildPackages.stdenv.cc ]; # `elf-header` is null when libc provides `elf.h`. - nativeBuildInputs = [ perl elf-header ]; + nativeBuildInputs = [ + perl elf-header + ] ++ lib.optionals stdenvNoCC.hostPlatform.isAndroid [ + flex bison python rsync + ]; extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"]; @@ -21,6 +30,8 @@ let hardeningDisable = lib.optional stdenvNoCC.buildPlatform.isDarwin "format"; + sourceRoot = lib.optionalString stdenvNoCC.hostPlatform.isAndroid "."; + makeFlags = [ "SHELL=bash" # Avoid use of runtime build->host compilers for checks. These @@ -36,9 +47,12 @@ let # Skip clean on darwin, case-sensitivity issues. buildPhase = lib.optionalString (!stdenvNoCC.buildPlatform.isDarwin) '' make mrproper $makeFlags - '' + '' + '' + (if stdenvNoCC.hostPlatform.isAndroid then '' + make defconfig + make headers_install + '' else '' make headers $makeFlags - ''; + ''); checkPhase = '' make headers_check $makeFlags diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 49f96c5a269..c45bec11f19 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11127,6 +11127,8 @@ in llvmPackages_7 else if isFreeBSD then llvmPackages_7 + else if isAndroid then + llvmPackages_12 else if isLinux then llvmPackages_7 else if isWasm then @@ -13993,8 +13995,10 @@ in bicgl = callPackage ../development/libraries/science/biology/bicgl { }; # TODO(@Ericson2314): Build bionic libc from source - bionic = assert stdenv.hostPlatform.useAndroidPrebuilt; - pkgs."androidndkPkgs_${stdenv.hostPlatform.ndkVer}".libraries; + bionic = if stdenv.hostPlatform.useAndroidPrebuilt + then pkgs."androidndkPkgs_${stdenv.hostPlatform.ndkVer}".libraries + else callPackage ../os-specific/linux/bionic-prebuilt { }; + bobcat = callPackage ../development/libraries/bobcat { }; @@ -19992,7 +19996,7 @@ in lkl = callPackage ../applications/virtualization/lkl { }; inherit (callPackages ../os-specific/linux/kernel-headers { }) - linuxHeaders; + linuxHeaders makeLinuxHeaders; kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { }; -- cgit 1.4.1 From f98633302381ab7e2839c61e41520371db8a8a74 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Mon, 22 Feb 2021 16:29:47 +0700 Subject: lib/systems/parse: make isCompatible description clearer and more useful Stating that CPUs and the isCompatible relation forms a category (or preorder) is correct but overtly technical. We can state it more clearly for readers unfamiliar with mathematics while retaining some keywords to be useful to technical readers. --- lib/systems/parse.nix | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index a06ac0d11f7..accaeb652d0 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -121,15 +121,20 @@ rec { js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; - # Determine where two CPUs are compatible with each other. That is, - # can we run code built for system b on system a? For that to - # happen, then the set of all possible possible programs that system - # b accepts must be a subset of the set of all programs that system - # a accepts. This compatibility relation forms a category where each - # CPU is an object and each arrow from a to b represents - # compatibility. CPUs with multiple modes of Endianness are - # isomorphic while all CPUs are endomorphic because any program - # built for a CPU can run on that CPU. + # Determine when two CPUs are compatible with each other. That is, + # can code built for system B run on system A? For that to happen, + # the programs that system B accepts must be a subset of the + # programs that system A accepts. + # + # We have the following properties of the compatibility relation, + # which must be preserved when adding compatibility information for + # additional CPUs. + # - (reflexivity) + # Every CPU is compatible with itself. + # - (transitivity) + # If A is compatible with B and B is compatible with C then A is compatible with C. + # - (compatible under multiple endianness) + # CPUs with multiple modes of endianness are pairwise compatible. isCompatible = a: b: with cpuTypes; lib.any lib.id [ # x86 (b == i386 && isCompatible a i486) -- cgit 1.4.1 From 18c38f8aee732b6202042383fc35997a39361830 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 1 May 2021 03:03:19 +0000 Subject: treewide: All the linker to be chosen independently This will begin the process of breaking up the `useLLVM` monolith. That is good in general, but I hope will be good for NetBSD and Darwin in particular. Co-authored-by: sterni --- lib/systems/default.nix | 13 +++++ .../networking/browsers/chromium/common.nix | 2 +- .../networking/browsers/firefox/common.nix | 18 ++++--- pkgs/build-support/cc-wrapper/default.nix | 1 + pkgs/development/compilers/llvm/10/default.nix | 50 ++++++++++++------ pkgs/development/compilers/llvm/11/default.nix | 50 ++++++++++++------ pkgs/development/compilers/llvm/12/default.nix | 50 ++++++++++++------ pkgs/development/compilers/llvm/7/default.nix | 53 +++++++++++++------ pkgs/development/compilers/llvm/8/default.nix | 50 ++++++++++++------ pkgs/development/compilers/llvm/9/default.nix | 50 ++++++++++++------ pkgs/os-specific/windows/default.nix | 2 +- pkgs/servers/clickhouse/default.nix | 4 +- pkgs/stdenv/cross/default.nix | 2 +- pkgs/top-level/all-packages.nix | 59 +++++++++++++++++++--- 14 files changed, 296 insertions(+), 108 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 21b00374da4..549f01b058f 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -41,6 +41,19 @@ rec { else if final.isNetBSD then "nblibc" # TODO(@Ericson2314) think more about other operating systems else "native/impure"; + # Choose what linker we wish to use by default. Someday we might also + # choose the C compiler, runtime library, C++ standard library, etc. in + # this way, nice and orthogonally, and deprecate `useLLVM`. But due to + # the monolithic GCC build we cannot actually make those choices + # independently, so we are just doing `linker` and keeping `useLLVM` for + # now. + linker = + /**/ if final.useLLVM or false then "lld" + else if final.isDarwin then "cctools" + # "bfd" and "gold" both come from GNU binutils. The existance of Gold + # is why we use the more obscure "bfd" and not "binutils" for this + # choice. + else "bfd"; extensions = { sharedLibrary = /**/ if final.isDarwin then ".dylib" diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix index f84ce23309f..2cf3556e7ea 100644 --- a/pkgs/applications/networking/browsers/chromium/common.nix +++ b/pkgs/applications/networking/browsers/chromium/common.nix @@ -137,7 +137,7 @@ let ninja pkg-config python2WithPackages perl nodejs gnutar which - llvmPackages.lldClang.bintools + llvmPackages.bintools ] ++ lib.optionals (chromiumVersionAtLeast "92") [ python3WithPackages ]; diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 48723249323..c97fe6efb77 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -98,16 +98,22 @@ let # clang LTO on Darwin is broken so the stdenv is not being changed. # Target the LLVM version that rustc -Vv reports it is built with for LTO. # rustPackages_1_45 -> LLVM 10, rustPackages -> LLVM 11 - llvmPackages = if stdenv.isDarwin - then buildPackages.llvmPackages - else if lib.versionAtLeast rustc.llvm.version "11" - then buildPackages.llvmPackages_11 - else buildPackages.llvmPackages_10; + llvmPackages0 = + /**/ if stdenv.isDarwin + then buildPackages.llvmPackages + else if lib.versionAtLeast rustc.llvm.version "11" + then buildPackages.llvmPackages_11 + else buildPackages.llvmPackages_10; + # Force the use of lld and other llvm tools for LTO + llvmPackages = llvmPackages0.override { + bootBintoolsNoLibc = null; + bootBintools = null; + }; # When LTO for Darwin is fixed, the following will need updating as lld # doesn't work on it. For now it is fine since ltoSupport implies no Darwin. buildStdenv = if ltoSupport - then overrideCC stdenv llvmPackages.lldClang + then overrideCC stdenv llvmPackages.clangUseLLVM else stdenv; nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d2941b537b7..235d244a7c0 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -64,6 +64,7 @@ let useGccForLibs = isClang && libcxx == null + && !stdenv.targetPlatform.isDarwin && !(stdenv.targetPlatform.useLLVM or false) && !(stdenv.targetPlatform.useAndroidPrebuilt or false) && !(stdenv.targetPlatform.isiOS or false) diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index bf3784c9794..8c5d0e45d7c 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools }: let @@ -36,6 +47,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -117,10 +137,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -139,10 +159,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -153,10 +173,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -166,20 +186,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -193,14 +213,14 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; @@ -216,21 +236,21 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libunwind = callPackage ./libunwind { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index 0e12bbbb2fc..94492890b7f 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools }: let @@ -38,6 +49,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -118,10 +138,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -140,10 +160,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -154,10 +174,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -167,20 +187,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -194,14 +214,14 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; @@ -217,21 +237,21 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libunwind = callPackage ./libunwind { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 2b464864222..97165e3b80b 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools , darwin }: @@ -39,6 +50,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -124,10 +144,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -146,10 +166,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -160,10 +180,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -173,20 +193,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -200,14 +220,14 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; @@ -223,14 +243,14 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; @@ -238,7 +258,7 @@ let inherit llvm_meta; inherit (buildLlvmTools) llvm; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 5dbe4e0d8f3..4d01ea2fae9 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools }: let @@ -35,6 +46,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -123,10 +143,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -145,10 +165,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -159,10 +179,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -172,20 +192,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -199,19 +219,20 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; # N.B. condition is safe because without useLLVM both are the same. - compiler-rt = if stdenv.hostPlatform.isAndroid + compiler-rt = + if stdenv.hostPlatform.isAndroid || (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isDarwin) then libraries.compiler-rt-libc else libraries.compiler-rt-no-libc; @@ -222,14 +243,14 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; @@ -237,7 +258,7 @@ let inherit llvm_meta; inherit (buildLlvmTools) llvm; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix index 9131a873b3b..856cd6e0661 100644 --- a/pkgs/development/compilers/llvm/8/default.nix +++ b/pkgs/development/compilers/llvm/8/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools }: let @@ -35,6 +46,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -124,10 +144,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -146,10 +166,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -160,10 +180,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -173,20 +193,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -200,14 +220,14 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; @@ -223,21 +243,21 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libunwind = callPackage ./libunwind { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix index 383a1260271..d13bff1f89b 100644 --- a/pkgs/development/compilers/llvm/9/default.nix +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -3,6 +3,17 @@ , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross +# This is the default binutils, but with *this* version of LLD rather +# than the default LLVM verion's, if LLD is the choice. We use these for +# the `useLLVM` bootstrapping below. +, bootBintoolsNoLibc ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintoolsNoLibc +, bootBintools ? + if stdenv.targetPlatform.linker == "lld" + then null + else pkgs.bintools }: let @@ -35,6 +46,15 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" ''; + bintoolsNoLibc' = + if bootBintoolsNoLibc == null + then tools.bintoolsNoLibc + else bootBintoolsNoLibc; + bintools' = + if bootBintools == null + then tools.bintools + else bootBintools; + in { libllvm = callPackage ./llvm { @@ -124,10 +144,10 @@ let bintools = tools.bintools-unwrapped; }; - lldClang = wrapCCWith rec { + clangUseLLVM = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = targetLlvmLibraries.libcxx; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt @@ -146,10 +166,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibcxx = wrapCCWith rec { + clangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -160,10 +180,10 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoLibc = wrapCCWith rec { + clangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -173,20 +193,20 @@ let '' + mkExtraBuildCommands cc; }; - lldClangNoCompilerRt = wrapCCWith rec { + clangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = tools.bintoolsNoLibc; + bintools = bintoolsNoLibc'; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags '' + mkExtraBuildCommands0 cc; }; - lldClangNoCompilerRtWithLibc = wrapCCWith rec { + clangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - inherit (tools) bintools; + bintools = bintools'; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -200,14 +220,14 @@ let compiler-rt-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc else stdenv; }; compiler-rt-no-libc = callPackage ./compiler-rt { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + then overrideCC stdenv buildLlvmTools.clangNoCompilerRt else stdenv; }; @@ -223,21 +243,21 @@ let libcxx = callPackage ./libcxx { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libcxxabi = callPackage ./libcxxabi { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; libunwind = callPackage ./libunwind { inherit llvm_meta; stdenv = if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx + then overrideCC stdenv buildLlvmTools.clangNoLibcxx else stdenv; }; diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix index 7c8041206ca..15e3d7f89ab 100644 --- a/pkgs/os-specific/windows/default.nix +++ b/pkgs/os-specific/windows/default.nix @@ -19,7 +19,7 @@ lib.makeScope newScope (self: with self; { crossThreadsStdenv = overrideCC crossLibcStdenv (if stdenv.hostPlatform.useLLVM or false - then buildPackages.llvmPackages_8.lldClangNoLibcxx + then buildPackages.llvmPackages_8.clangNoLibcxx else buildPackages.gccCrossStageStatic.override (old: { bintools = old.bintools.override { libc = libcCross; diff --git a/pkgs/servers/clickhouse/default.nix b/pkgs/servers/clickhouse/default.nix index 087f9628505..9607c435fcd 100644 --- a/pkgs/servers/clickhouse/default.nix +++ b/pkgs/servers/clickhouse/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, libtool, lldClang, ninja +{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, libtool, llvm-bintools, ninja , boost, brotli, capnproto, cctz, clang-unwrapped, double-conversion , icu, jemalloc, libcpuid, libxml2, lld, llvm, lz4, libmysqlclient, openssl, perl , poco, protobuf, python3, rapidjson, re2, rdkafka, readline, sparsehash, unixODBC @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { sha256 = "0c87k0xqwj9sc3xy2f3ngfszgjiz4rzd787bdg6fxp94w1adjhny"; }; - nativeBuildInputs = [ cmake libtool lldClang.bintools ninja ]; + nativeBuildInputs = [ cmake libtool llvm-bintools ninja ]; buildInputs = [ boost brotli capnproto cctz clang-unwrapped double-conversion icu jemalloc libcpuid libxml2 lld llvm lz4 libmysqlclient openssl perl diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index ed2b291ca2a..a9fd21534ff 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -66,7 +66,7 @@ in lib.init bootStages ++ [ else if crossSystem.isDarwin then buildPackages.llvmPackages.clang else if crossSystem.useLLVM or false - then buildPackages.llvmPackages.lldClang + then buildPackages.llvmPackages.clangUseLLVM else buildPackages.gcc; extraNativeBuildInputs = old.extraNativeBuildInputs diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3fd6a307b43..2cbca0a5c03 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -48,7 +48,22 @@ in lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null); }; - stdenvNoLibs = mkStdenvNoLibs stdenv; + stdenvNoLibs = + if stdenv.hostPlatform != stdenv.buildPlatform && (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isDarwin.useLLVM or false) + then + # We cannot touch binutils or cc themselves, because that will cause + # infinite recursion. So instead, we just choose a libc based on the + # current platform. That means we won't respect whatever compiler was + # passed in with the stdenv stage argument. + # + # TODO It would be much better to pass the `stdenvNoCC` and *unwrapped* + # cc, bintools, compiler-rt equivalent, etc. and create all final stdenvs + # as part of the stage. Then we would never be tempted to override a + # later thing to to create an earlier thing (leading to infinite + # recursion) and we also would still respect the stage arguments choices + # for these things. + overrideCC stdenv buildPackages.llvmPackages.clangNoCompilerRt + else mkStdenvNoLibs stdenv; gccStdenvNoLibs = mkStdenvNoLibs gccStdenv; clangStdenvNoLibs = mkStdenvNoLibs clangStdenv; @@ -10451,8 +10466,8 @@ in gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic; crossLibcStdenv = - if stdenv.hostPlatform.useLLVM or false - then overrideCC stdenv buildPackages.llvmPackages.lldClangNoLibc + if stdenv.hostPlatform.useLLVM or false || stdenv.hostPlatform.isDarwin + then overrideCC stdenv buildPackages.llvmPackages.clangNoLibc else gccCrossLibcStdenv; # The GCC used to build libc for the target platform. Normal gccs will be @@ -12630,6 +12645,37 @@ in libc = preLibcCrossHeaders; }; + # Here we select the default bintools implementations to be used. Note when + # cross compiling these are used not for this stage but the *next* stage. + # That is why we choose using this stage's target platform / next stage's + # host platform. + # + # Because this is the *next* stages choice, it's a bit non-modular to put + # here. In theory, bootstraping is supposed to not be a chain but at tree, + # where each stage supports many "successor" stages, like multiple possible + # futures. We don't have a better alternative, but with this downside in + # mind, please be judicious when using this attribute. E.g. for building + # things in *this* stage you should use probably `stdenv.cc.bintools` (from a + # default or alternate `stdenv`), at build time, and try not to "force" a + # specific bintools at runtime at all. + # + # In other words, try to only use this in wrappers, and only use those + # wrappers from the next stage. + bintools-unwrapped = let + inherit (stdenv.targetPlatform) linker; + in if linker == "lld" then llvmPackages.bintools-unwrapped + else if linker == "cctools" then darwin.binutils-unwrapped + else if linker == "bfd" then binutils-unwrapped + else if linker == "gold" then binutils-unwrapped + else null; + bintoolsNoLibc = wrapBintoolsWith { + bintools = bintools-unwrapped; + libc = preLibcCrossHeaders; + }; + bintools = wrapBintoolsWith { + bintools = bintools-unwrapped; + }; + bison = callPackage ../development/tools/parsing/bison { }; # Ruby fails to build with current bison @@ -14765,8 +14811,8 @@ in # These are used when buiding compiler-rt / libgcc, prior to building libc. preLibcCrossHeaders = let inherit (stdenv.targetPlatform) libc; - in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers - else if libc == "nblibc" then targetPackages.netbsdCross.headers + in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers + else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers else null; # We can choose: @@ -18702,7 +18748,8 @@ in clickhouse = callPackage ../servers/clickhouse { # upstream requires llvm10 as of v20.11.4.13 - inherit (llvmPackages_10) clang-unwrapped lld lldClang llvm; + inherit (llvmPackages_10) clang-unwrapped lld llvm; + llvm-bintools = llvmPackages_10.bintools; }; clickhouse-cli = with python3Packages; toPythonApplication clickhouse-cli; -- cgit 1.4.1 From a6753d0c4255b1efa6a941efb3d8d7a39ec956e3 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 7 Dec 2020 23:48:40 -0600 Subject: lib/systems: add aarch64-darwin to mesaPlatforms --- lib/systems/doubles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 6f638be585b..c6d90ba9850 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -96,5 +96,5 @@ in { embedded = filterDoubles predicates.isNone; - mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux"]; + mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin"]; } -- cgit 1.4.1 From 3a3df3146e244b6b36a5fa10e2c4890a59fce3b2 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sat, 9 Jan 2021 21:38:45 +0800 Subject: Add crossPkgs.aarch64-darwin --- lib/systems/examples.nix | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/systems') diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index d5f2f2068b4..6a8f4e091aa 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -240,6 +240,12 @@ rec { useiOSPrebuilt = true; }; + aarch64-darwin = { + config = "aarch64-apple-darwin"; + xcodePlatform = "MacOSX"; + platform = {}; + }; + # # Windows # -- cgit 1.4.1 From 23cae56ca720fadb1040e7739a30bff7dbda38c8 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Tue, 9 Feb 2021 15:58:21 +0900 Subject: lib/systems/platforms: add Apple M1 --- lib/systems/platforms.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index f46e9c826a5..445144439ca 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -375,6 +375,13 @@ rec { }; }; + apple-m1 = { + gcc = { + arch = "armv8.3-a+crypto+sha2+aes+crc+fp16+lse+simd+ras+rdm+rcpc"; + cpu = "apple-a13"; + }; + }; + ## ## MIPS ## @@ -495,7 +502,10 @@ rec { else if lib.versionOlder version "6" then sheevaplug else if lib.versionOlder version "7" then raspberrypi else armv7l-hf-multiplatform - else if platform.isAarch64 then aarch64-multiplatform + + else if platform.isAarch64 then + if platform.isDarwin then apple-m1 + else aarch64-multiplatform else if platform.isRiscV then riscv-multiplatform -- cgit 1.4.1 From 755d980440a9aefba6a0aebfc367621acd892cf6 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Mon, 15 Feb 2021 15:45:37 +0900 Subject: darwin: use "11.0" as sdk and minimum version on aarch64-darwin --- lib/systems/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 549f01b058f..70ec98b03c1 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -131,7 +131,7 @@ rec { else null; # The canonical name for this attribute is darwinSdkVersion, but some # platforms define the old name "sdkVer". - darwinSdkVersion = final.sdkVer or "10.12"; + darwinSdkVersion = final.sdkVer or (if final.isAarch64 then "11.0" else "10.12"); darwinMinVersion = final.darwinSdkVersion; darwinMinVersionVariable = if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET" -- cgit 1.4.1 From 805e9ce9ea37953e319251fb2f814d9ee8f250b3 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Mon, 31 May 2021 23:01:49 -0700 Subject: platforms: Build flat kernel image for RISC-V Newer bootloaders for RISC-V (i.e., OpenSBI + U-Boot) support flat and compressed kernel images but not vmlinux. Therefore, let's build "Image" like what we do with aarch64. Also copy DTBs while we are at it. --- lib/systems/platforms.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 445144439ca..73a61d6d984 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -481,9 +481,10 @@ rec { riscv-multiplatform = { linux-kernel = { name = "riscv-multiplatform"; - target = "vmlinux"; + target = "Image"; autoModules = true; baseConfig = "defconfig"; + DTB = true; extraConfig = '' FTRACE n SERIAL_OF_PLATFORM y -- cgit 1.4.1 From e2aee93caf067159c18634466c46913b28ec6394 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Mon, 31 May 2021 23:24:02 -0700 Subject: platforms: Enable ftrace support for RISC-V Support has landed in mainline for a while. --- lib/systems/platforms.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index 73a61d6d984..92285346f75 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -486,7 +486,6 @@ rec { baseConfig = "defconfig"; DTB = true; extraConfig = '' - FTRACE n SERIAL_OF_PLATFORM y ''; }; -- cgit 1.4.1 From 5a8372d04e5afbca44daed90ff82e0f0003e59b2 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 1 Jun 2021 14:52:18 +0000 Subject: lib.systems.parse.kernels: fix typo in comment --- lib/systems/parse.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index accaeb652d0..b27d37f55ae 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -276,7 +276,7 @@ rec { kernels = with execFormats; with kernelFamilies; setTypes types.openKernel { # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as - # the nnormalized name for macOS. + # the normalized name for macOS. macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; ios = { execFormat = macho; families = { inherit darwin; }; }; freebsd = { execFormat = elf; families = { inherit bsd; }; }; -- cgit 1.4.1 From 4d6a0bb9667c8083076a96744bdc71643c6febc6 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 1 Jun 2021 14:54:14 +0000 Subject: lib.systems.parsed: add "elf" for some NetBSD archs In Autoconf, some old NetBSD targets like "i686-unknown-netbsd" are interpreted as a.out, not elf, and virtually nothing supports it. We need to specify e.g. "i686-unknown-netbsdelf" to get the right behaviour. --- lib/systems/parse.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index b27d37f55ae..2b789fd8ecb 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -121,6 +121,14 @@ rec { js = { bits = 32; significantByte = littleEndian; family = "js"; }; }; + # GNU build systems assume that older NetBSD architectures are using a.out. + gnuNetBSDDefaultExecFormat = cpu: + if (cpu.family == "x86" && cpu.bits == 32) || + (cpu.family == "arm" && cpu.bits == 32) || + (cpu.family == "sparc" && cpu.bits == 32) + then execFormats.aout + else execFormats.elf; + # Determine when two CPUs are compatible with each other. That is, # can code built for system B run on system A? For that to happen, # the programs that system B accepts must be a subset of the @@ -463,8 +471,12 @@ rec { else "${cpu.name}-${kernel.name}"; tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let + optExecFormat = + lib.optionalString (kernel.name == "netbsd" && + gnuNetBSDDefaultExecFormat cpu != kernel.execFormat) + kernel.execFormat.name; optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}"; - in "${cpu.name}-${vendor.name}-${kernel.name}${optAbi}"; + in "${cpu.name}-${vendor.name}-${kernel.name}${optExecFormat}${optAbi}"; ################################################################################ -- cgit 1.4.1 From afe09e41df7e59619340ccf1dfbab940adc1e3e3 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Wed, 2 Jun 2021 22:22:44 -0700 Subject: mesaPlatforms: Welcome riscv64-linux to the family --- lib/systems/doubles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index c6d90ba9850..61ba7dad7cc 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -96,5 +96,5 @@ in { embedded = filterDoubles predicates.isNone; - mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin"]; + mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin" "riscv64-linux"]; } -- cgit 1.4.1 From 407953e9df712b6d89295f1c402e8778a249a748 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Sat, 24 Jul 2021 01:20:02 +0700 Subject: Initial implementation of m68k cross-compile --- lib/systems/doubles.nix | 4 +++- lib/systems/examples.nix | 4 ++++ lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 2 ++ lib/tests/systems.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 61ba7dad7cc..b8d154ad635 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -28,6 +28,7 @@ let "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" + "m68k-linux" # MMIXware "mmix-mmixware" @@ -39,7 +40,7 @@ let # none "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" - "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" + "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" "m68k-none" "x86_64-none" # OpenBSD @@ -74,6 +75,7 @@ in { riscv = filterDoubles predicates.isRiscV; vc4 = filterDoubles predicates.isVc4; or1k = filterDoubles predicates.isOr1k; + m68k = filterDoubles predicates.isM68k; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 6a8f4e091aa..ce7515bc9cc 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -144,6 +144,10 @@ rec { libc = "newlib"; }; + m68k = { + config = "m68k-unknown-linux-gnu"; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index d2b7271210c..a74847d4340 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -26,6 +26,7 @@ rec { isAvr = { cpu = { family = "avr"; }; }; isAlpha = { cpu = { family = "alpha"; }; }; isOr1k = { cpu = { family = "or1k"; }; }; + isM68k = { cpu = { family = "m68k"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 2b789fd8ecb..8a8b0888149 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -95,6 +95,8 @@ rec { mmix = { bits = 64; significantByte = bigEndian; family = "mmix"; }; + m68k = { bits = 32; significantByte = bigEndian; family = "m68k"; }; + powerpc = { bits = 32; significantByte = bigEndian; family = "power"; }; powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; }; powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; }; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 36f82b783b4..378dc537598 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests { testredox = mseteq redox [ "x86_64-redox" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; - testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" ]; + testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" ]; testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 5d2f2f977a7..0674c88924e 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -208,6 +208,7 @@ stdenv.mkDerivation { else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isVc4 then "vc4" else if targetPlatform.isOr1k then "or1k" + else if targetPlatform.isM68k then "m68k" else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" -- cgit 1.4.1 From 0f1204bd2be0ca1ea60b70d6d1eb7a11077f6986 Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Sat, 24 Jul 2021 01:20:02 +0700 Subject: Initial implementation of s390 cross-compile --- lib/systems/doubles.nix | 5 +++-- lib/systems/examples.nix | 4 ++++ lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 2 ++ lib/tests/systems.nix | 2 +- pkgs/build-support/bintools-wrapper/default.nix | 1 + 6 files changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/systems') diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index b8d154ad635..aa630b51ed8 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -28,7 +28,7 @@ let "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" - "m68k-linux" + "m68k-linux" "s390-linux" # MMIXware "mmix-mmixware" @@ -41,7 +41,7 @@ let # none "aarch64-none" "arm-none" "armv6l-none" "avr-none" "i686-none" "msp430-none" "or1k-none" "powerpc-none" "riscv32-none" "riscv64-none" "vc4-none" "m68k-none" - "x86_64-none" + "s390-none" "x86_64-none" # OpenBSD "i686-openbsd" "x86_64-openbsd" @@ -76,6 +76,7 @@ in { vc4 = filterDoubles predicates.isVc4; or1k = filterDoubles predicates.isOr1k; m68k = filterDoubles predicates.isM68k; + s390 = filterDoubles predicates.isS390; js = filterDoubles predicates.isJavaScript; bigEndian = filterDoubles predicates.isBigEndian; diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index ce7515bc9cc..32b236d6960 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -148,6 +148,10 @@ rec { config = "m68k-unknown-linux-gnu"; }; + s390 = { + config = "s390-unknown-linux-gnu"; + }; + arm-embedded = { config = "arm-none-eabi"; libc = "newlib"; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index a74847d4340..2fba95aa1a6 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -27,6 +27,7 @@ rec { isAlpha = { cpu = { family = "alpha"; }; }; isOr1k = { cpu = { family = "or1k"; }; }; isM68k = { cpu = { family = "m68k"; }; }; + isS390 = { cpu = { family = "s390"; }; }; isJavaScript = { cpu = cpuTypes.js; }; is32bit = { cpu = { bits = 32; }; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index 8a8b0888149..386f252f2ba 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -105,6 +105,8 @@ rec { riscv32 = { bits = 32; significantByte = littleEndian; family = "riscv"; }; riscv64 = { bits = 64; significantByte = littleEndian; family = "riscv"; }; + s390 = { bits = 32; significantByte = bigEndian; family = "s390"; }; + sparc = { bits = 32; significantByte = bigEndian; family = "sparc"; }; sparc64 = { bits = 64; significantByte = bigEndian; family = "sparc"; }; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 378dc537598..6bd43f0d0d0 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -28,7 +28,7 @@ with lib.systems.doubles; lib.runTests { testredox = mseteq redox [ "x86_64-redox" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); testillumos = mseteq illumos [ "x86_64-solaris" ]; - testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" ]; + testlinux = mseteq linux [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "riscv32-linux" "riscv64-linux" "x86_64-linux" "powerpc64-linux" "powerpc64le-linux" "m68k-linux" "s390-linux" ]; testnetbsd = mseteq netbsd [ "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" ]; testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 0674c88924e..82d17369743 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -209,6 +209,7 @@ stdenv.mkDerivation { else if targetPlatform.isVc4 then "vc4" else if targetPlatform.isOr1k then "or1k" else if targetPlatform.isM68k then "m68k" + else if targetPlatform.isS390 then "s390" else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" -- cgit 1.4.1