diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 5b2fa00291301..49e9c991bdd38 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -119,72 +119,48 @@ let hash = "sha256-YrmFkVpwPreiig1/BsP+DInpTdQrPmS7bEY0WUGpw+c="; }; -in lib.makeExtensible (self: ({ - nix_2_3 = (common rec { - version = "2.3.16"; - src = fetchurl { - url = "https://nixos.org/releases/nix/nix-${version}/nix-${version}.tar.xz"; - hash = "sha256-fuaBtp8FtSVJLSAsO+3Nne4ZYLuBj2JpD2xEk7fCqrw="; - }; - patches = [ - patch-monitorfdhup - ]; - }).override { boehmgc = boehmgc-nix_2_3; }; - - nix_2_10 = common { - version = "2.10.3"; - hash = "sha256-B9EyDUz/9tlcWwf24lwxCFmkxuPTVW7HFYvp0C4xGbc="; - patches = [ - ./patches/flaky-tests.patch - patch-non-existing-output - patch-monitorfdhup - patch-sqlite-exception - ]; - }; +in lib.makeExtensible (self: { + + # Please keep the attrset containing these `throw`s *before* the + # `versions` attrset, so the `throw` only occurs if the file is + # missing. + # + # This allows developers to resurrect old versions, at their own + # risk, by reverting the deletion of the $major.$minor.nix file. + # Unlike a file edit, reverting a deletion won't cause a merge + # conflict with every subsequent rebase that touches nearby + # lines of code. - nix_2_11 = common { - version = "2.11.1"; - hash = "sha256-qCV65kw09AG+EkdchDPq7RoeBznX0Q6Qa4yzPqobdOk="; - patches = [ - ./patches/flaky-tests.patch - patch-non-existing-output - patch-monitorfdhup - patch-sqlite-exception - ]; - }; + nix_2_4 = throw "nixVersions.nix_2_4 has been removed"; - nix_2_12 = common { - version = "2.12.1"; - hash = "sha256-GmHKhq0uFtdOiJnuBwj2YwlZjvh6YTkfQZgeu4e0dLU="; - patches = [ - ./patches/flaky-tests.patch - patch-monitorfdhup - patch-sqlite-exception - ]; - }; + nix_2_5 = throw "nixVersions.nix_2_5 has been removed"; - nix_2_13 = common { - version = "2.13.3"; - hash = "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc="; - patches = [ - patch-fix-aarch64-darwin-static - ]; - }; + nix_2_6 = throw "nixVersions.nix_2_6 has been removed"; - nix_2_14 = common { - version = "2.14.1"; - hash = "sha256-5aCmGZbsFcLIckCDfvnPD4clGPQI7qYAqHYlttN/Wkg="; - }; + nix_2_7 = throw "nixVersions.nix_2_7 has been removed"; - nix_2_15 = common { - version = "2.15.1"; - hash = "sha256-o7bxsNeq2LF6/dTl+lT2k50bSItkID80/uoZYVtlxro="; - }; + nix_2_8 = throw "nixVersions.nix_2_8 has been removed"; - nix_2_16 = common { - version = "2.16.1"; - hash = "sha256-/XCWa2osNFIpPC5MkxlX6qTZf/DaTLwS3LWN0SRFiuU="; - }; + nix_2_9 = throw "nixVersions.nix_2_9 has been removed"; + +} // + +(let + # Given a version number, produce a derivation for that Nix version. + version_to_derivation = version: + callPackage (./versions + "/${version}") { + inherit common patch-sqlite-exception boehmgc-nix_2_3 patch-monitorfdhup patch-fix-aarch64-darwin-static; + }; + versions = lib.attrNames (builtins.readDir ./versions); + version_to_nameValuePair_drv = version: + lib.nameValuePair + "nix_${lib.replaceStrings ["."] ["_"] version}" + (version_to_derivation version); + +in + lib.listToAttrs (map version_to_nameValuePair_drv versions)) + +// { # The minimum Nix version supported by Nixpkgs # Note that some functionality *might* have been backported into this Nix version, @@ -218,4 +194,4 @@ in lib.makeExtensible (self: ({ nix_2_8 = throw "nixVersions.nix_2_8 has been removed"; nix_2_9 = throw "nixVersions.nix_2_9 has been removed"; -})) +}) diff --git a/pkgs/tools/package-management/nix/patches/install-nlohmann_json-headers.patch b/pkgs/tools/package-management/nix/patches/install-nlohmann_json-headers.patch new file mode 100644 index 0000000000000..8b92de2290320 --- /dev/null +++ b/pkgs/tools/package-management/nix/patches/install-nlohmann_json-headers.patch @@ -0,0 +1,36 @@ +From 3884f7a69a57d8ecfcbcaae476ec2ff53ffbd549 Mon Sep 17 00:00:00 2001 +From: Robert Hensing +Date: Thu, 11 Nov 2021 11:03:21 +0100 +Subject: [PATCH] Install nlohmann_json headers + +These headers are included by the libexpr, libfetchers, libstore +and libutil headers. +Considering that these are vendored sources, Nix should expose them, +as it is not a good idea for reverse dependencies to rely on a +potentially different source that can go out of sync. +--- + Makefile | 1 + + src/nlohmann/local.mk | 2 ++ + 2 files changed, 3 insertions(+) + create mode 100644 src/nlohmann/local.mk + +diff --git a/Makefile b/Makefile +index 5040d288485..e6ce50cbdb7 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,6 +10,7 @@ makefiles = \ + src/libexpr/local.mk \ + src/libcmd/local.mk \ + src/nix/local.mk \ ++ src/nlohmann/local.mk \ + src/resolve-system-dependencies/local.mk \ + scripts/local.mk \ + misc/bash/local.mk \ +diff --git a/src/nlohmann/local.mk b/src/nlohmann/local.mk +new file mode 100644 +index 00000000000..63c427e000e +--- /dev/null ++++ b/src/nlohmann/local.mk +@@ -0,0 +1,2 @@ ++$(foreach i, $(wildcard src/nlohmann/*.hpp), \ ++ $(eval $(call install-file-in, $(i), $(includedir)/nlohmann, 0644))) diff --git a/pkgs/tools/package-management/nix/versions/2.10/default.nix b/pkgs/tools/package-management/nix/versions/2.10/default.nix new file mode 100644 index 0000000000000..9a5c104bf071e --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.10/default.nix @@ -0,0 +1,22 @@ +{ common +, fetchpatch +, patch-sqlite-exception +, patch-monitorfdhup +, ... +}: + +common { + version = "2.10.3"; + hash = "sha256-B9EyDUz/9tlcWwf24lwxCFmkxuPTVW7HFYvp0C4xGbc="; + patches = [ + ../../patches/flaky-tests.patch + (fetchpatch { + # https://github.com/NixOS/nix/pull/7283 + name = "fix-requires-non-existing-output.patch"; + url = "https://github.com/NixOS/nix/commit/3ade5f5d6026b825a80bdcc221058c4f14e10a27.patch"; + hash = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0="; + }) + patch-sqlite-exception + patch-monitorfdhup + ]; +} diff --git a/pkgs/tools/package-management/nix/versions/2.11/default.nix b/pkgs/tools/package-management/nix/versions/2.11/default.nix new file mode 100644 index 0000000000000..7c6bbc7c12535 --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.11/default.nix @@ -0,0 +1,22 @@ +{ common +, fetchpatch +, patch-sqlite-exception +, patch-monitorfdhup +, ... +}: + +common { + version = "2.11.1"; + hash = "sha256-qCV65kw09AG+EkdchDPq7RoeBznX0Q6Qa4yzPqobdOk="; + patches = [ + ../../patches/flaky-tests.patch + (fetchpatch { + # https://github.com/NixOS/nix/pull/7283 + name = "fix-requires-non-existing-output.patch"; + url = "https://github.com/NixOS/nix/commit/3ade5f5d6026b825a80bdcc221058c4f14e10a27.patch"; + hash = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0="; + }) + patch-sqlite-exception + patch-monitorfdhup + ]; +} diff --git a/pkgs/tools/package-management/nix/versions/2.12/default.nix b/pkgs/tools/package-management/nix/versions/2.12/default.nix new file mode 100644 index 0000000000000..63ff4a93c9ead --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.12/default.nix @@ -0,0 +1,15 @@ +{ common +, patch-sqlite-exception +, patch-monitorfdhup +, ... +}: + +common { + version = "2.12.0"; + hash = "sha256-sQ9C101CL/eVN5JgH91ozHFWU4+bXr8/Fi/8NQk6xRI="; + patches = [ + ../../patches/flaky-tests.patch + patch-sqlite-exception + patch-monitorfdhup + ]; +} diff --git a/pkgs/tools/package-management/nix/versions/2.13/default.nix b/pkgs/tools/package-management/nix/versions/2.13/default.nix new file mode 100644 index 0000000000000..98c24d596255f --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.13/default.nix @@ -0,0 +1,12 @@ +{ common +, patch-fix-aarch64-darwin-static +, ... +}: + +common { + version = "2.13.1"; + hash = "sha256-uXh4+xjJUHQSCg+LHh6+SSYtMdjKQiTXMZ4uZFwzdq4="; + patches = [ + patch-fix-aarch64-darwin-static + ]; +} diff --git a/pkgs/tools/package-management/nix/versions/2.14/default.nix b/pkgs/tools/package-management/nix/versions/2.14/default.nix new file mode 100644 index 0000000000000..52ee2b57ec673 --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.14/default.nix @@ -0,0 +1,8 @@ +{ common +, ... +}: + +common { + version = "2.14.1"; + hash = "sha256-5aCmGZbsFcLIckCDfvnPD4clGPQI7qYAqHYlttN/Wkg="; +} diff --git a/pkgs/tools/package-management/nix/versions/2.15/default.nix b/pkgs/tools/package-management/nix/versions/2.15/default.nix new file mode 100644 index 0000000000000..9acd70e34da4f --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.15/default.nix @@ -0,0 +1,8 @@ +{ common +, ... +}: + +common { + version = "2.15.1"; + hash = "sha256-o7bxsNeq2LF6/dTl+lT2k50bSItkID80/uoZYVtlxro="; +} diff --git a/pkgs/tools/package-management/nix/versions/2.16/default.nix b/pkgs/tools/package-management/nix/versions/2.16/default.nix new file mode 100644 index 0000000000000..d6b3e0c00079b --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.16/default.nix @@ -0,0 +1,8 @@ +{ common +, ... +}: + +common { + version = "2.16.1"; + hash = "sha256-/XCWa2osNFIpPC5MkxlX6qTZf/DaTLwS3LWN0SRFiuU="; +} diff --git a/pkgs/tools/package-management/nix/versions/2.3/default.nix b/pkgs/tools/package-management/nix/versions/2.3/default.nix new file mode 100644 index 0000000000000..28954789a863d --- /dev/null +++ b/pkgs/tools/package-management/nix/versions/2.3/default.nix @@ -0,0 +1,21 @@ +{ boehmgc-nix_2_3 +, fetchurl +, common +, patch-monitorfdhup +, ... +}: + +(common rec { + version = "2.3.16"; + src = fetchurl { + url = "https://nixos.org/releases/nix/nix-${version}/nix-${version}.tar.xz"; + hash = "sha256-fuaBtp8FtSVJLSAsO+3Nne4ZYLuBj2JpD2xEk7fCqrw="; + }; + patches = [ + patch-monitorfdhup + ]; +}) + .override { + boehmgc = boehmgc-nix_2_3; + } +