From c2b411e67475b42f7130a202183b90801f9874b6 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 8 Oct 2024 11:02:09 +0200 Subject: [PATCH] lib.oldestSupportedReleaseIsAtLeast: rename from bad name and deprecate after 24.11 It seems impossible to describe this condition more concisely without making it incomprehensible. --- lib/default.nix | 2 +- lib/trivial.nix | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/default.nix b/lib/default.nix index 4d0035945aaa..aff1df150f13 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -73,7 +73,7 @@ let inherit (self.trivial) id const pipe concat or and xor bitAnd bitOr bitXor bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum - info showWarnings nixpkgsVersion version isInOldestRelease + info showWarnings nixpkgsVersion version isInOldestRelease oldestSupportedReleaseIsAtLeast mod compare splitByAndCompare seq deepSeq lessThan add sub functionArgs setFunctionArgs isFunction toFunction mirrorFunctionArgs fromHexString toHexString toBaseDigits inPureEvalMode isBool isInt pathExists diff --git a/lib/trivial.nix b/lib/trivial.nix index f0afbf609fca..205224126094 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -397,6 +397,15 @@ in { Set it to the upcoming release, matching the nixpkgs/.version file. */ isInOldestRelease = + lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2411) + "lib.isInOldestRelease is deprecated. Use lib.oldestSupportedReleaseIsAtLeast instead." + lib.oldestSupportedReleaseIsAtLeast; + + /** + Alias for `isInOldestRelease` introduced in 24.11. + Use `isInOldestRelease` in expressions outside of Nixpkgs for greater compatibility. + */ + oldestSupportedReleaseIsAtLeast = release: release <= lib.trivial.oldestSupportedRelease;