diff --git a/lib/systems/architectures.nix b/lib/systems/architectures.nix index ddc320d24e0a0..7e6315f75320d 100644 --- a/lib/systems/architectures.nix +++ b/lib/systems/architectures.nix @@ -2,9 +2,10 @@ rec { # gcc.arch to its features (as in /proc/cpuinfo) - features = { - default = [ ]; + features = rec { + default = x86-64-v2; # x86_64 Intel + nehalem = [ "sse3" "ssse3" "sse4_1" "sse4_2" "aes" ]; 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" ]; @@ -28,6 +29,12 @@ rec { 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" ]; + # Microarchitecture levels + # https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels + x86-64 = [ ]; + x86-64-v2 = [ "sse3" "ssse3" "sse4_1" "sse4_2" ]; + x86-64-v3 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "avx" "avx2" "fma" ]; + x86-64-v4 = [ "sse3" "ssse3" "sse4_1" "sse4_2" "avx" "avx2" "avx512" "fma" ]; # other armv5te = [ ]; armv6 = [ ]; @@ -40,14 +47,19 @@ rec { # 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 = [ ]; + default = [ "x86-64-v2" ]; + x86-64 = [ ]; + x86-64-v2 = [ "x86-64" ] ++ inferiors.x86-64; + nehalem = [ "x86-64-v2" ] ++ inferiors.x86-64-v2; + westmere = [ "nehalem" ] ++ inferiors.nehalem; sandybridge = [ "westmere" ] ++ inferiors.westmere; ivybridge = [ "sandybridge" ] ++ inferiors.sandybridge; - haswell = [ "ivybridge" ] ++ inferiors.ivybridge; + x86-64-v3 = [ "ivybridge" ] ++ inferiors.ivybridge; + haswell = [ "x86-64-v3" ] ++ inferiors.x86-64-v3; broadwell = [ "haswell" ] ++ inferiors.haswell; skylake = [ "broadwell" ] ++ inferiors.broadwell; - skylake-avx512 = [ "skylake" ] ++ inferiors.skylake; + x86-64-v4 = [ "skylake" ] ++ inferiors.skylake; + skylake-avx512 = [ "x86-64-v4" ] ++ inferiors.x86-64-v4; # x86_64 AMD # TODO: fill this (need testing) diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix index d574943e47df3..f762be869c890 100644 --- a/lib/systems/platforms.nix +++ b/lib/systems/platforms.nix @@ -16,6 +16,12 @@ rec { autoModules = true; target = "bzImage"; }; + gcc = { + # this should match the microarchitecture level of lib.systems.architectures.features.default + # but nehalem is used instead of x86-64-v2 because as of writting the bootstrapping gcc in stage 0 does not understand it + arch = "nehalem"; + tune = "generic"; + }; }; pc_simplekernel = lib.recursiveUpdate pc { diff --git a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml index c8bd237dbb003..4c835f46e43fc 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2305.section.xml @@ -10,7 +10,16 @@ In addition to numerous new and upgraded packages, this release has the following highlights: - + + + + On x86 platforms nixpkgs is now build by default with the + x86_64-v2 microarchitecture level. This + means any x86 processor that does not support SSE4.2 and AES + instructions is no longer supported by the precompiled binary + cache. + + Cinnamon has been updated to 5.6, see diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index c438fdc1aaafd..6a29f2e5e520e 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -8,6 +8,9 @@ In addition to numerous new and upgraded packages, this release has the followin +- On x86 platforms nixpkgs is now built by default with the `x86_64-v2` microarchitecture level. + This means any x86 processor that does not support SSE4.2 and AES instructions is no longer supported by the precompiled binary cache. + - Cinnamon has been updated to 5.6, see [the pull request](https://github.com/NixOS/nixpkgs/pull/201328#issue-1449910204) for what is changed. ## New Services {#sec-release-23.05-new-services} diff --git a/nixos/release-small.nix b/nixos/release-small.nix index deb428d1bec05..bb5b623a792b7 100644 --- a/nixos/release-small.nix +++ b/nixos/release-small.nix @@ -25,6 +25,22 @@ let nixpkgs = nixpkgsSrc; }) [ "unstable" ]; + nixpkgs-unoptimised' = builtins.removeAttrs (import ../pkgs/top-level/release.nix { + inherit supportedSystems; + nixpkgs = nixpkgsSrc; + # default value plus empty gcc.arch/gcc.tune + nixpkgsArgs = { + config = { + allowUnfree = false; + gcc = { + arch = null; + tune = null; + }; + inHydra = true; + }; + }; + }) [ "unstable" ]; + in rec { nixos = { @@ -85,6 +101,31 @@ in rec { vim; }; + nixpkgs-unoptimised = { + inherit (nixpkgs-unoptimised') + apacheHttpd + cmake + cryptsetup + emacs + gettext + git + imagemagick + jdk + linux + mariadb + nginx + nodejs + openssh + php + postgresql + python + rsyslog + stdenv + subversion + tarball + vim; + }; + tested = let onSupported = x: map (system: "${x}.${system}") supportedSystems; onSystems = systems: x: map (system: "${x}.${system}") diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 510537aac9f39..622b772a7c488 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -413,7 +413,10 @@ else let enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) { NIX_HARDENING_ENABLE = enabledHardeningOptions; - } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch) { + } // lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform ? gcc.arch + # ignore x86-64-v1/2, nehalem and westmere to allow a smoother transition when bumping the default gcc.arch. + # This silently assumes that any x86 machines supports them at least! + && lib.all (x: stdenv.hostPlatform.gcc.arch != x) [ "x86-64" "x86-64-v2" "nehalem" "westmere" ]) { requiredSystemFeatures = attrs.requiredSystemFeatures or [] ++ [ "gccarch-${stdenv.hostPlatform.gcc.arch}" ]; } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { inherit __darwinAllowLocalNetworking;