Skip to content

Commit

Permalink
nix: put each version in a separate file
Browse files Browse the repository at this point in the history
Some of us need to keep around specific versions of nix.

The recent churn of which Nix versions are or are not in nixpkgs is
causing a lot of merge conflicts for us.

Let's put each version in a separate file, so these churn commits
aren't constantly conflicting with nearby lines of code.
  • Loading branch information
Adam Joseph committed Apr 13, 2023
1 parent 2f924d9 commit e618baa
Show file tree
Hide file tree
Showing 13 changed files with 216 additions and 105 deletions.
131 changes: 26 additions & 105 deletions pkgs/tools/package-management/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,114 +61,35 @@ let
};

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";
sha256 = "sha256-fuaBtp8FtSVJLSAsO+3Nne4ZYLuBj2JpD2xEk7fCqrw=";
};
patches = [
patch-monitorfdhup
];
}).override { boehmgc = boehmgc-nix_2_3; };

nix_2_4 = common {
version = "2.4";
sha256 = "sha256-op48CCDgLHK0qV1Batz4Ln5FqBiRjlE6qHTiZgt3b6k=";
# https://github.com/NixOS/nix/pull/5537
patches = [ ./patches/install-nlohmann_json-headers.patch ];
};

nix_2_5 = common {
version = "2.5.1";
sha256 = "sha256-GOsiqy9EaTwDn2PLZ4eFj1VkXcBUbqrqHehRE9GuGdU=";
# https://github.com/NixOS/nix/pull/5536
patches = [ ./patches/install-nlohmann_json-headers.patch ];
};

# This is the last version of nix where https://github.com/NixOS/nix/issues/6572
# is not an unsolved breaking bug. Please keep it until the issue is fixed
# and in latest stable nix.
nix_2_6 = common {
version = "2.6.1";
sha256 = "sha256-E9iQ7f+9Z6xFcUvvfksTEfn8LsDfzmwrcRBC//5B3V0=";
};

nix_2_7 = common {
version = "2.7.0";
sha256 = "sha256-m8tqCS6uHveDon5GSro5yZor9H+sHeh+v/veF1IGw24=";
patches = [
# remove when there's a 2.7.1 release
# https://github.com/NixOS/nix/pull/6297
# https://github.com/NixOS/nix/issues/6243
# https://github.com/NixOS/nixpkgs/issues/163374
(fetchpatch {
url = "https://github.com/NixOS/nix/commit/c9afca59e87afe7d716101e6a75565b4f4b631f7.patch";
sha256 = "sha256-xz7QnWVCI12lX1+K/Zr9UpB93b10t1HS9y/5n5FYf8Q=";
})
];
};

nix_2_8 = common {
version = "2.8.1";
sha256 = "sha256-zldZ4SiwkISFXxrbY/UdwooIZ3Z/I6qKxtpc3zD0T/o=";
};

nix_2_9 = common {
version = "2.9.2";
sha256 = "sha256-uZCaBo9rdWRO/AlQMvVVjpAwzYijB2H5KKQqde6eHkg=";
patches = [
(fetchpatch {
# https://github.com/NixOS/nix/pull/7283
name = "fix-requires-non-existing-output.patch";
url = "https://github.com/NixOS/nix/commit/3ade5f5d6026b825a80bdcc221058c4f14e10a27.patch";
sha256 = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0=";
})
patch-sqlite-exception
];
};

nix_2_10 = common {
version = "2.10.3";
sha256 = "sha256-B9EyDUz/9tlcWwf24lwxCFmkxuPTVW7HFYvp0C4xGbc=";
patches = [
./patches/flaky-tests.patch
patch-non-existing-output
patch-monitorfdhup
patch-sqlite-exception
];
};

nix_2_11 = common {
version = "2.11.1";
sha256 = "sha256-qCV65kw09AG+EkdchDPq7RoeBznX0Q6Qa4yzPqobdOk=";
patches = [
./patches/flaky-tests.patch
patch-non-existing-output
patch-monitorfdhup
patch-sqlite-exception
];
};
# 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.

} //

(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;
};
versions = lib.attrNames (builtins.readDir ./versions);
version_to_nameValuePair_drv = version:
lib.nameValuePair
"nix_${lib.replaceStrings ["."] ["_"] version}"
(version_to_derivation version);

nix_2_12 = common {
version = "2.12.1";
sha256 = "sha256-GmHKhq0uFtdOiJnuBwj2YwlZjvh6YTkfQZgeu4e0dLU=";
patches = [
./patches/flaky-tests.patch
patch-monitorfdhup
patch-sqlite-exception
];
};
in
lib.listToAttrs (map version_to_nameValuePair_drv versions))

nix_2_13 = common {
version = "2.13.3";
sha256 = "sha256-jUc2ccTR8f6MGY2pUKgujm+lxSPNGm/ZAP+toX+nMNc=";
};

nix_2_14 = common {
version = "2.14.1";
sha256 = "sha256-5aCmGZbsFcLIckCDfvnPD4clGPQI7qYAqHYlttN/Wkg=";
};
// {

stable = self.nix_2_13;

Expand Down
22 changes: 22 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.10/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ common
, fetchpatch
, patch-sqlite-exception
, patch-monitorfdhup
, ...
}:

common {
version = "2.10.3";
sha256 = "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";
sha256 = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0=";
})
patch-sqlite-exception
patch-monitorfdhup
];
}
22 changes: 22 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.11/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ common
, fetchpatch
, patch-sqlite-exception
, patch-monitorfdhup
, ...
}:

common {
version = "2.11.1";
sha256 = "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";
sha256 = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0=";
})
patch-sqlite-exception
patch-monitorfdhup
];
}
15 changes: 15 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.12/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ common
, patch-sqlite-exception
, patch-monitorfdhup
, ...
}:

common {
version = "2.12.0";
sha256 = "sha256-sQ9C101CL/eVN5JgH91ozHFWU4+bXr8/Fi/8NQk6xRI=";
patches = [
../../patches/flaky-tests.patch
patch-sqlite-exception
patch-monitorfdhup
];
}
8 changes: 8 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.13/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ common
, ...
}:

common {
version = "2.13.1";
sha256 = "sha256-uXh4+xjJUHQSCg+LHh6+SSYtMdjKQiTXMZ4uZFwzdq4=";
}
8 changes: 8 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.14/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ common
, ...
}:

common {
version = "2.14.1";
sha256 = "sha256-5aCmGZbsFcLIckCDfvnPD4clGPQI7qYAqHYlttN/Wkg=";
}
19 changes: 19 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.3/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ 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";
sha256 = "sha256-fuaBtp8FtSVJLSAsO+3Nne4ZYLuBj2JpD2xEk7fCqrw=";
};
patches = [ patch-monitorfdhup ];
})
.override {
boehmgc = boehmgc-nix_2_3;
}

12 changes: 12 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.4/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ common
, fetchurl
, ...
}:

common {
version = "2.4";
sha256 = "sha256-op48CCDgLHK0qV1Batz4Ln5FqBiRjlE6qHTiZgt3b6k=";
# https://github.com/NixOS/nix/pull/5537
patches = [ ../../patches/install-nlohmann_json-headers.patch ];
}

11 changes: 11 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.5/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ common
, ...
}:

common {
version = "2.5.1";
sha256 = "sha256-GOsiqy9EaTwDn2PLZ4eFj1VkXcBUbqrqHehRE9GuGdU=";
# https://github.com/NixOS/nix/pull/5536
patches = [ ../../patches/install-nlohmann_json-headers.patch ];
}

14 changes: 14 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.6/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ common
, patch-monitorfdhup
, ...
}:

common {
version = "2.6.1";
sha256 = "sha256-E9iQ7f+9Z6xFcUvvfksTEfn8LsDfzmwrcRBC//5B3V0=";
patches = [
patch-monitorfdhup
];
}


23 changes: 23 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.7/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ common
, fetchpatch
, patch-monitorfdhup
, ...
}:

common {
version = "2.7.0";
sha256 = "sha256-m8tqCS6uHveDon5GSro5yZor9H+sHeh+v/veF1IGw24=";
patches = [
# remove when there's a 2.7.1 release
# https://github.com/NixOS/nix/pull/6297
# https://github.com/NixOS/nix/issues/6243
# https://github.com/NixOS/nixpkgs/issues/163374
(fetchpatch {
url = "https://github.com/NixOS/nix/commit/c9afca59e87afe7d716101e6a75565b4f4b631f7.patch";
sha256 = "sha256-xz7QnWVCI12lX1+K/Zr9UpB93b10t1HS9y/5n5FYf8Q=";
})
../../patches/flaky-tests.patch
patch-monitorfdhup
];
}

14 changes: 14 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.8/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ common
, patch-monitorfdhup
, ...
}:

common {
version = "2.8.1";
sha256 = "sha256-zldZ4SiwkISFXxrbY/UdwooIZ3Z/I6qKxtpc3zD0T/o=";
patches = [
../../patches/flaky-tests.patch
patch-monitorfdhup
];
}

22 changes: 22 additions & 0 deletions pkgs/tools/package-management/nix/versions/2.9/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ common
, fetchpatch
, patch-sqlite-exception
, patch-monitorfdhup
, ...
}:

common {
version = "2.9.2";
sha256 = "sha256-uZCaBo9rdWRO/AlQMvVVjpAwzYijB2H5KKQqde6eHkg=";
patches = [
(fetchpatch {
# https://github.com/NixOS/nix/pull/7283
name = "fix-requires-non-existing-output.patch";
url = "https://github.com/NixOS/nix/commit/3ade5f5d6026b825a80bdcc221058c4f14e10a27.patch";
sha256 = "sha256-s1ybRFCjQaSGj7LKu0Z5g7UiHqdJGeD+iPoQL0vaiS0=";
})
patch-sqlite-exception
patch-monitorfdhup
../../patches/flaky-tests.patch
];
}

0 comments on commit e618baa

Please sign in to comment.