From 729225e355c02113371ce500a8d55fcaede2e900 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 8 Oct 2024 11:14:24 +0200 Subject: [PATCH] treewide: lib.isInOldestRelease -> lib.oldestSupportedReleaseIsAtLeast --- lib/attrsets.nix | 4 ++-- lib/modules.nix | 8 ++++---- lib/sources.nix | 6 +++--- lib/strings.nix | 2 +- nixos/lib/testing/nodes.nix | 2 +- pkgs/build-support/substitute/substitute.nix | 2 +- pkgs/development/haskell-modules/lib/compose.nix | 4 ++-- pkgs/development/interpreters/python/passthrufun.nix | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 8bb4ef972fd8..7b8feb4fe89b 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -5,7 +5,7 @@ let inherit (builtins) head length; - inherit (lib.trivial) isInOldestRelease mergeAttrs warn warnIf; + inherit (lib.trivial) oldestSupportedReleaseIsAtLeast mergeAttrs warn warnIf; inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName; inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl; in @@ -2137,6 +2137,6 @@ rec { "lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith; # DEPRECATED - cartesianProductOfSets = warnIf (isInOldestRelease 2405) + cartesianProductOfSets = warnIf (oldestSupportedReleaseIsAtLeast 2405) "lib.cartesianProductOfSets is a deprecated alias of lib.cartesianProduct." cartesianProduct; } diff --git a/lib/modules.nix b/lib/modules.nix index 3472085a763b..855ffaf25ed8 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -23,7 +23,7 @@ let isAttrs isBool isFunction - isInOldestRelease + oldestSupportedReleaseIsAtLeast isList isString length @@ -1030,7 +1030,7 @@ let mkForce = mkOverride 50; mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’ - defaultPriority = warnIf (isInOldestRelease 2305) "lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead." defaultOverridePriority; + defaultPriority = warnIf (oldestSupportedReleaseIsAtLeast 2305) "lib.modules.defaultPriority is deprecated, please use lib.modules.defaultOverridePriority instead." defaultOverridePriority; mkFixStrictness = warn "lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls." id; @@ -1146,8 +1146,8 @@ let }: doRename { inherit from to; visible = false; - warn = isInOldestRelease sinceRelease; - use = warnIf (isInOldestRelease sinceRelease) + warn = oldestSupportedReleaseIsAtLeast sinceRelease; + use = warnIf (oldestSupportedReleaseIsAtLeast sinceRelease) "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'."; }; diff --git a/lib/sources.nix b/lib/sources.nix index f61ea306aec5..62c4a214536b 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -256,15 +256,15 @@ let in { - pathType = lib.warnIf (lib.isInOldestRelease 2305) + pathType = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) "lib.sources.pathType has been moved to lib.filesystem.pathType." lib.filesystem.pathType; - pathIsDirectory = lib.warnIf (lib.isInOldestRelease 2305) + pathIsDirectory = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) "lib.sources.pathIsDirectory has been moved to lib.filesystem.pathIsDirectory." lib.filesystem.pathIsDirectory; - pathIsRegularFile = lib.warnIf (lib.isInOldestRelease 2305) + pathIsRegularFile = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) "lib.sources.pathIsRegularFile has been moved to lib.filesystem.pathIsRegularFile." lib.filesystem.pathIsRegularFile; diff --git a/lib/strings.nix b/lib/strings.nix index ffde541c6958..d9a2d786ed28 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -2272,7 +2272,7 @@ rec { isCoercibleToString :: a -> bool ``` */ - isCoercibleToString = lib.warnIf (lib.isInOldestRelease 2305) + isCoercibleToString = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) "lib.strings.isCoercibleToString is deprecated in favor of either isStringLike or isConvertibleWithToString. Only use the latter if it needs to return true for null, numbers, booleans and list of similarly coercibles." isConvertibleWithToString; diff --git a/nixos/lib/testing/nodes.nix b/nixos/lib/testing/nodes.nix index 9aecca10ac6b..8b14d0a3bffd 100644 --- a/nixos/lib/testing/nodes.nix +++ b/nixos/lib/testing/nodes.nix @@ -151,7 +151,7 @@ in nodesCompat = mapAttrs (name: config: config // { - config = lib.warnIf (lib.isInOldestRelease 2211) + config = lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211) "Module argument `nodes.${name}.config` is deprecated. Use `nodes.${name}` instead." config; }) diff --git a/pkgs/build-support/substitute/substitute.nix b/pkgs/build-support/substitute/substitute.nix index 37233a306840..e6f0835c8f8e 100644 --- a/pkgs/build-support/substitute/substitute.nix +++ b/pkgs/build-support/substitute/substitute.nix @@ -39,7 +39,7 @@ let optionalDeprecationWarning = # substitutions is only available starting 24.05. # TODO: Remove support for replacements sometime after the next release - lib.warnIf (args ? replacements && lib.isInOldestRelease 2405) '' + lib.warnIf (args ? replacements && lib.oldestSupportedReleaseIsAtLeast 2405) '' pkgs.substitute: For "${name}", `replacements` is used, which is deprecated since it doesn't support arguments with spaces. Use `substitutions` instead: substitutions = [ ${deprecationReplacement} ];''; in diff --git a/pkgs/development/haskell-modules/lib/compose.nix b/pkgs/development/haskell-modules/lib/compose.nix index 3661c74d499a..cbefc44bb01d 100644 --- a/pkgs/development/haskell-modules/lib/compose.nix +++ b/pkgs/development/haskell-modules/lib/compose.nix @@ -466,7 +466,7 @@ rec { which is cross aware instead. */ generateOptparseApplicativeCompletions = commands: pkg: - lib.warnIf (lib.isInOldestRelease 2211) "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" + lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211) "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" (pkgs.lib.foldr __generateOptparseApplicativeCompletion pkg commands); /* @@ -475,7 +475,7 @@ rec { which is cross aware instead. */ generateOptparseApplicativeCompletion = command: pkg: - lib.warnIf (lib.isInOldestRelease 2211) "haskellLib.generateOptparseApplicativeCompletion is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions (plural!). Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" + lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211) "haskellLib.generateOptparseApplicativeCompletion is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions (plural!). Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" (__generateOptparseApplicativeCompletion command pkg); # Don't fail at configure time if there are multiple versions of the diff --git a/pkgs/development/interpreters/python/passthrufun.nix b/pkgs/development/interpreters/python/passthrufun.nix index b06433113b6b..dc2f3c7dc17c 100644 --- a/pkgs/development/interpreters/python/passthrufun.nix +++ b/pkgs/development/interpreters/python/passthrufun.nix @@ -93,7 +93,7 @@ in rec { inherit hasDistutilsCxxPatch; # Remove after 24.11 is released. pythonForBuild = - lib.warnIf (lib.isInOldestRelease 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`" + lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2311) "`pythonForBuild` (from `python*`) has been renamed to `pythonOnBuildForHost`" pythonOnBuildForHost_overridden; pythonOnBuildForHost = pythonOnBuildForHost_overridden;