From 1b7637ff0806095b09bfd4380d435050acffd006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 26 Aug 2025 09:50:34 +0200 Subject: [PATCH] nix_2_24: remove --- ci/default.nix | 2 +- lib/tests/release.nix | 2 +- .../nix/common-autoconf.nix | 323 ------------------ pkgs/tools/package-management/nix/default.nix | 42 +-- 4 files changed, 12 insertions(+), 357 deletions(-) delete mode 100644 pkgs/tools/package-management/nix/common-autoconf.nix diff --git a/ci/default.nix b/ci/default.nix index da6e3f877e3b..19229e85414e 100644 --- a/ci/default.nix +++ b/ci/default.nix @@ -147,7 +147,7 @@ rec { parse = pkgs.lib.recurseIntoAttrs { latest = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.latest; }; lix = pkgs.callPackage ./parse.nix { nix = pkgs.lix; }; - nix_2_24 = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.nix_2_24; }; + nix_2_28 = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.nix_2_28; }; }; shell = import ../shell.nix { inherit nixpkgs system; }; tarball = import ../pkgs/top-level/make-tarball.nix { diff --git a/lib/tests/release.nix b/lib/tests/release.nix index 3eb62912ffc4..4209fd9274b6 100644 --- a/lib/tests/release.nix +++ b/lib/tests/release.nix @@ -9,7 +9,7 @@ pkgsBB ? pkgs.pkgsBuildBuild, nix ? pkgs-nixVersions.stable, nixVersions ? [ - pkgs-nixVersions.nix_2_24 + pkgs-nixVersions.nix_2_28 nix pkgs-nixVersions.latest ], diff --git a/pkgs/tools/package-management/nix/common-autoconf.nix b/pkgs/tools/package-management/nix/common-autoconf.nix deleted file mode 100644 index 8dfefe1544a2..000000000000 --- a/pkgs/tools/package-management/nix/common-autoconf.nix +++ /dev/null @@ -1,323 +0,0 @@ -{ - lib, - fetchFromGitHub, - version, - suffix ? "", - hash ? null, - src ? fetchFromGitHub { - owner = "NixOS"; - repo = "nix"; - rev = version; - inherit hash; - }, - patches ? [ ], - knownVulnerabilities ? [ ], - maintainers ? [ - lib.maintainers.lovesegfault - lib.maintainers.artturin - ], - teams ? [ lib.teams.nix ], - self_attribute_name, -}@args: -assert (hash == null) -> (src != null); -let - atLeast24 = lib.versionAtLeast version "2.4"; - atLeast225 = lib.versionAtLeast version "2.25pre"; -in -{ - stdenv, - autoconf-archive, - autoreconfHook, - bash, - bison, - boehmgc, - boost, - brotli, - busybox-sandbox-shell, - bzip2, - callPackage, - coreutils, - curl, - docbook_xsl_ns, - docbook5, - editline, - flex, - git, - gnutar, - gtest, - gzip, - jq, - lib, - libarchive, - libcpuid, - libgit2, - libsodium, - libxml2, - libxslt, - lowdown, - lowdown-unsandboxed, - toml11, - man, - mdbook, - mdbook-linkcheck, - nlohmann_json, - nixosTests, - openssl, - perl, - python3, - pkg-config, - rapidcheck, - sqlite, - util-linuxMinimal, - xz, - enableDocumentation ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, - enableStatic ? stdenv.hostPlatform.isStatic, - withAWS ? - lib.meta.availableOn stdenv.hostPlatform aws-c-common - && !enableStatic - && (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin) - && atLeast24, - aws-c-common, - aws-sdk-cpp, - withLibseccomp ? lib.meta.availableOn stdenv.hostPlatform libseccomp, - libseccomp, - - confDir, - stateDir, - storeDir, - - # passthru tests - pkgsi686Linux, - pkgsStatic, - runCommand, - pkgs, -}: -let - self = stdenv.mkDerivation { - pname = "nix"; - - version = "${version}${suffix}"; - VERSION_SUFFIX = suffix; - - inherit src patches; - - outputs = [ - "out" - "dev" - ] - ++ lib.optionals enableDocumentation [ - "man" - "doc" - ]; - - hardeningEnable = lib.optionals (!stdenv.hostPlatform.isDarwin) [ "pie" ]; - - hardeningDisable = [ - "shadowstack" - ] - ++ lib.optional stdenv.hostPlatform.isMusl "fortify"; - - nativeInstallCheckInputs = [ - git - man - ]; - - nativeBuildInputs = [ - pkg-config - autoconf-archive - autoreconfHook - bison - flex - jq - ] - ++ lib.optionals enableDocumentation [ - (lib.getBin lowdown-unsandboxed) - mdbook - mdbook-linkcheck - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - util-linuxMinimal - ]; - - buildInputs = [ - boost - brotli - bzip2 - curl - editline - libsodium - openssl - sqlite - xz - gtest - libarchive - lowdown - libgit2 - toml11 - rapidcheck - ] - ++ lib.optionals (atLeast225 && enableDocumentation) [ - python3 - ] - ++ lib.optionals (stdenv.hostPlatform.isx86_64) [ - libcpuid - ] - ++ lib.optionals withLibseccomp [ - libseccomp - ] - ++ lib.optionals withAWS [ - aws-sdk-cpp - ]; - - propagatedBuildInputs = [ - boehmgc - nlohmann_json - ]; - - postPatch = '' - patchShebangs --build tests - ''; - - preConfigure = - # Copy libboost_context so we don't get all of Boost in our closure. - # https://github.com/NixOS/nixpkgs/issues/45462 - lib.optionalString (!enableStatic) '' - mkdir -p $out/lib - cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib - rm -f $out/lib/*.a - ${lib.optionalString stdenv.hostPlatform.isLinux '' - chmod u+w $out/lib/*.so.* - patchelf --set-rpath $out/lib:${lib.getLib stdenv.cc.cc}/lib $out/lib/libboost_thread.so.* - ''} - ''; - - configureFlags = [ - "--with-store-dir=${storeDir}" - "--localstatedir=${stateDir}" - "--sysconfdir=${confDir}" - "--enable-gc" - ] - ++ lib.optionals (!enableDocumentation) [ - "--disable-doc-gen" - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - "--with-sandbox-shell=${busybox-sandbox-shell}/bin/busybox" - ] - ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isStatic) [ - "--enable-embedded-sandbox-shell" - ] - ++ - lib.optionals - ( - stdenv.hostPlatform != stdenv.buildPlatform - && stdenv.hostPlatform ? nix - && stdenv.hostPlatform.nix ? system - ) - [ - "--with-system=${stdenv.hostPlatform.nix.system}" - ] - ++ lib.optionals (!withLibseccomp) [ - # RISC-V support in progress https://github.com/seccomp/libseccomp/pull/50 - "--disable-seccomp-sandboxing" - ] - ++ lib.optionals (stdenv.cc.isGNU && !enableStatic) [ - "--enable-lto" - ]; - - env.CXXFLAGS = toString ( - lib.optionals (lib.versionAtLeast lowdown.version "1.4.0") [ - # Autotools based build system wasn't updated with the backport of - # https://github.com/NixOS/nix/pull/12115, so set the define explicitly. - "-DHAVE_LOWDOWN_1_4" - ] - ); - - makeFlags = [ - # gcc runs multi-threaded LTO using make and does not yet detect the new fifo:/path style - # of make jobserver. until gcc adds support for this we have to instruct make to use this - # old style or LTO builds will run their linking on only one thread, which takes forever. - "--jobserver-style=pipe" - "profiledir=$(out)/etc/profile.d" - ] - ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "PRECOMPILE_HEADERS=0" - ++ lib.optional (stdenv.hostPlatform.isDarwin) "PRECOMPILE_HEADERS=1"; - - installFlags = [ "sysconfdir=$(out)/etc" ]; - - doInstallCheck = true; - installCheckTarget = "installcheck"; - - # socket path becomes too long otherwise - preInstallCheck = - lib.optionalString stdenv.hostPlatform.isDarwin '' - export TMPDIR=$NIX_BUILD_TOP - '' - # Prevent crashes in libcurl due to invoking Objective-C `+initialize` methods after `fork`. - # See http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html. - + lib.optionalString stdenv.hostPlatform.isDarwin '' - export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES - '' - # See https://github.com/NixOS/nix/issues/5687 - + lib.optionalString (stdenv.hostPlatform.isDarwin) '' - echo "exit 99" > tests/gc-non-blocking.sh - '' # TODO: investigate why this broken - + lib.optionalString (stdenv.hostPlatform.system == "aarch64-linux") '' - echo "exit 0" > tests/functional/flakes/show.sh - '' - + '' - # nixStatic otherwise does not find its man pages in tests. - export MANPATH=$man/share/man:$MANPATH - ''; - - separateDebugInfo = stdenv.hostPlatform.isLinux && !enableStatic; - - enableParallelBuilding = true; - - passthru = { - inherit aws-sdk-cpp boehmgc; - - perl-bindings = perl.pkgs.toPerlModule ( - callPackage ./nix-perl.nix { - nix = self; - } - ); - - tests = import ./tests.nix { - inherit - runCommand - version - src - lib - stdenv - pkgs - pkgsi686Linux - pkgsStatic - nixosTests - self_attribute_name - ; - nix = self; - }; - }; - - # point 'nix edit' and ofborg at the file that defines the attribute, - # not this common file. - pos = builtins.unsafeGetAttrPos "version" args; - meta = with lib; { - description = "Powerful package manager that makes package management reliable and reproducible"; - longDescription = '' - Nix is a powerful package manager for Linux and other Unix systems that - makes package management reliable and reproducible. It provides atomic - upgrades and rollbacks, side-by-side installation of multiple versions of - a package, multi-user package management and easy setup of build - environments. - ''; - homepage = "https://nixos.org/"; - license = licenses.lgpl21Plus; - inherit knownVulnerabilities maintainers teams; - platforms = platforms.unix; - outputsToInstall = [ "out" ] ++ optional enableDocumentation "man"; - mainProgram = "nix"; - }; - }; -in -self diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 231f514a627b..5ab965e908d0 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -5,7 +5,6 @@ nixDependencies, generateSplicesForMkScope, fetchFromGitHub, - fetchpatch2, runCommand, pkgs, pkgsi686Linux, @@ -17,21 +16,6 @@ confDir ? "/etc", }: let - - # Called for Nix < 2.26 - commonAutoconf = - args: - nixDependencies.callPackage - (import ./common-autoconf.nix ({ inherit lib fetchFromGitHub; } // args)) - { - inherit - storeDir - stateDir - confDir - ; - inherit (nixDependencies) aws-sdk-cpp; - }; - # Called for Nix == 2.28. Transitional until we always use # per-component packages. commonMeson = @@ -44,13 +28,6 @@ let ; }; - # https://github.com/NixOS/nix/pull/7585 - patch-monitorfdhup = fetchpatch2 { - name = "nix-7585-monitor-fd-hup.patch"; - url = "https://github.com/NixOS/nix/commit/1df3d62c769dc68c279e89f68fdd3723ed3bcb5a.patch"; - hash = "sha256-f+F0fUO+bqyPXjt+IXJtISVr589hdc3y+Cdrxznb+Nk="; - }; - # Intentionally does not support overrideAttrs etc # Use only for tests that are about the package relation to `pkgs` and/or NixOS. addTestsShallowly = @@ -142,17 +119,17 @@ let nixComponentsAttributeName ]; + maintainers = [ + lib.maintainers.lovesegfault + lib.maintainers.artturin + ]; + teams = [ lib.teams.nix ]; + in lib.makeExtensible ( self: ( { - nix_2_24 = commonAutoconf { - version = "2.24.15"; - hash = "sha256-GHqFHLxvRID2IEPUwIfRMp8epYQMFcvG9ogLzfWRbPc="; - self_attribute_name = "nix_2_24"; - }; - nix_2_28 = commonMeson { version = "2.28.4"; hash = "sha256-V1tPrBkPteqF8VWUgpotNFYJ2Xm6WmB3aMPexuEHl9I="; @@ -161,7 +138,7 @@ lib.makeExtensible ( nixComponents_2_29 = nixDependencies.callPackage ./modular/packages.nix { version = "2.29.1"; - inherit (self.nix_2_24.meta) maintainers teams; + inherit maintainers teams; otherSplices = generateSplicesForNixComponents "nixComponents_2_29"; src = fetchFromGitHub { owner = "NixOS"; @@ -175,7 +152,7 @@ lib.makeExtensible ( nixComponents_2_30 = nixDependencies.callPackage ./modular/packages.nix rec { version = "2.30.2"; - inherit (self.nix_2_24.meta) maintainers teams; + inherit maintainers teams; otherSplices = generateSplicesForNixComponents "nixComponents_2_30"; src = fetchFromGitHub { owner = "NixOS"; @@ -189,7 +166,7 @@ lib.makeExtensible ( nixComponents_git = nixDependencies.callPackage ./modular/packages.nix rec { version = "2.31pre20250712_${lib.substring 0 8 src.rev}"; - inherit (self.nix_2_24.meta) maintainers teams; + inherit maintainers teams; otherSplices = generateSplicesForNixComponents "nixComponents_git"; src = fetchFromGitHub { owner = "NixOS"; @@ -218,6 +195,7 @@ lib.makeExtensible ( ) // { nixComponents_2_27 = throw "nixComponents_2_27 has been removed. use nixComponents_git."; + nix_2_24 = throw "nix_2_24 has been removed. use nix_2_28."; nix_2_26 = throw "nix_2_26 has been removed. use nix_2_28."; nix_2_27 = throw "nix_2_27 has been removed. use nix_2_28."; nix_2_25 = throw "nix_2_25 has been removed. use nix_2_28.";