diff --git a/doc/release-notes/rl-2511.section.md b/doc/release-notes/rl-2511.section.md index f83792f0a3cd..3b4cc77e6e1d 100644 --- a/doc/release-notes/rl-2511.section.md +++ b/doc/release-notes/rl-2511.section.md @@ -342,16 +342,32 @@ ### Breaking changes {#sec-nixpkgs-release-25.11-lib-breaking} +- `lib.literalExample` has been removed, use `lib.literalExpression` instead, or use `lib.literalMD` for a non-Nix description. + +- `lib.replaceChars` has been removed, it was a deprecated alias of `lib.replaceStrings`. + +- `lib.readPathsFromFile` has been removed, use a list instead + - `lib.mapAttrsFlatten` has been removed, following its deprecation in NixOS 24.11. Use `lib.attrsets.mapAttrsToList` instead. +- `lib.strings.isCoercibleToString` has been in favor of either `lib.strings.isStringLike` or `lib.strings.isConvertibleWithToString`. Only use the latter if it needs to return true for null, numbers, booleans, or a list of those. + +- `lib.types.string` has been removed. See [this pull request](https://github.com/NixOS/nixpkgs/pull/66346) for better alternative types like `lib.types.str`. + +- `lib.modules.defaultPriority` has been removed, please use `lib.modules.defaultOverridePriority` instead. + - `lib.attrsets.cartesianProductOfSets` has been removed, following its deprecation in NixOS 24.11. Use `lib.attrsets.cartesianProduct` instead. +- `lib.sources.pathType`, `lib.sources.pathIsDirectory` and `lib.sources.pathIsRegularFile` have been replaced by `lib.filesystem.pathType`, `lib.filesystem.pathIsDirectory` and `lib.filesystem.pathIsRegularFile` respectively. + - `lib.attrsets.zip` has been removed, following its deprecation in 2013. Use `lib.attrsets.zipAttrsWith` instead. - `lib.attrsets.zipWithNames` has been removed, following its deprecation in 2009. Use `lib.attrsets.zipAttrsWithNames` instead. - `lib.options.mkPackageOptionMD` has been removed, following its deprecation in NixOS 24.11. Use `lib.options.mkPackageOption` instead. +- `haskell.lib.addOptparseApplicativeCompletionScripts` has been removed, use `haskellPackages.generateOptparseApplicativeCompletions` instead. + - The `buildPythonPackage` and `buildPythonApplication` functions now require an explicit `format` attribute. Previously the default format used setuptools and called `setup.py` from the source tree, which is deprecated. diff --git a/lib/customisation.nix b/lib/customisation.nix index 39b59d7cdf6f..9319fad0b822 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -22,7 +22,6 @@ let filterAttrs optionalString flip - pathIsDirectory head pipe isDerivation diff --git a/lib/default.nix b/lib/default.nix index cbb58e302504..afd9ecd2154c 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -344,7 +344,6 @@ let escapeRegex escapeURL escapeXML - replaceChars lowerChars upperChars toLower @@ -377,7 +376,6 @@ let fixedWidthNumber toInt toIntBase10 - readPathsFromFile fileContents ; inherit (self.stringsWithDeps) @@ -495,7 +493,6 @@ let optionAttrSetToDocList' scrubOptionValue literalExpression - literalExample showOption showOptionWithDefLocs showFiles diff --git a/lib/modules.nix b/lib/modules.nix index 42e88dbbf625..5f6d803da233 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1468,11 +1468,6 @@ let mkForce = mkOverride 50; mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’ - 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; mkOrder = priority: content: { @@ -2162,7 +2157,6 @@ private inherit defaultOrderPriority defaultOverridePriority - defaultPriority doRename evalModules evalOptionValue # for use by lib.types diff --git a/lib/options.nix b/lib/options.nix index 75f8bfa2535c..b1db6ff76e46 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -684,8 +684,6 @@ rec { inherit text; }; - literalExample = lib.warn "lib.literalExample is deprecated, use lib.literalExpression instead, or use lib.literalMD for a non-Nix description." literalExpression; - /** For use in the `defaultText` and `example` option attributes. Causes the given MD text to be inserted verbatim in the documentation, for when diff --git a/lib/sources.nix b/lib/sources.nix index 4d67ea30b62c..78335bd9f06d 100644 --- a/lib/sources.nix +++ b/lib/sources.nix @@ -509,22 +509,6 @@ let in { - - pathType = - lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) - "lib.sources.pathType has been moved to lib.filesystem.pathType." - lib.filesystem.pathType; - - pathIsDirectory = - lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) - "lib.sources.pathIsDirectory has been moved to lib.filesystem.pathIsDirectory." - lib.filesystem.pathIsDirectory; - - pathIsRegularFile = - lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2305) - "lib.sources.pathIsRegularFile has been moved to lib.filesystem.pathIsRegularFile." - lib.filesystem.pathIsRegularFile; - inherit pathIsGitRepo commitIdFromGitRepo diff --git a/lib/strings.nix b/lib/strings.nix index 77d7bb939eb5..5d3183bcef06 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -1467,9 +1467,6 @@ rec { [ "\"" "'" "<" ">" "&" ] [ """ "'" "<" ">" "&" ]; - # warning added 12-12-2022 - replaceChars = lib.warn "lib.replaceChars is a deprecated alias of lib.replaceStrings." builtins.replaceStrings; - # Case conversion utilities. lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz"; upperChars = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -2578,30 +2575,6 @@ rec { in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}" result; - /** - Check whether a value `val` can be coerced to a string. - - :::{.warning} - Soft-deprecated function. While the original implementation is available as - `isConvertibleWithToString`, consider using `isStringLike` instead, if suitable. - ::: - - # Inputs - - `val` - : 1\. Function argument - - # Type - - ``` - isCoercibleToString :: a -> bool - ``` - */ - 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; - /** Check whether a list or other value `x` can be passed to toString. @@ -2842,60 +2815,6 @@ rec { else parsedInput; - /** - Read a list of paths from `file`, relative to the `rootPath`. - Lines beginning with `#` are treated as comments and ignored. - Whitespace is significant. - - :::{.warning} - This function is deprecated and should be avoided. - ::: - - :::{.note} - This function is not performant and should be avoided. - ::: - - # Inputs - - `rootPath` - : 1\. Function argument - - `file` - : 2\. Function argument - - # Type - - ``` - readPathsFromFile :: string -> string -> [string] - ``` - - # Examples - :::{.example} - ## `lib.strings.readPathsFromFile` usage example - - ```nix - readPathsFromFile /prefix - ./pkgs/development/libraries/qt-5/5.4/qtbase/series - => [ "/prefix/dlopen-resolv.patch" "/prefix/tzdir.patch" - "/prefix/dlopen-libXcursor.patch" "/prefix/dlopen-openssl.patch" - "/prefix/dlopen-dbus.patch" "/prefix/xdg-config-dirs.patch" - "/prefix/nix-profiles-library-paths.patch" - "/prefix/compose-search-path.patch" ] - ``` - - ::: - */ - readPathsFromFile = lib.warn "lib.readPathsFromFile is deprecated, use a list instead." ( - rootPath: file: - let - lines = lib.splitString "\n" (readFile file); - removeComments = lib.filter (line: line != "" && !(lib.hasPrefix "#" line)); - relativePaths = removeComments lines; - absolutePaths = map (path: rootPath + "/${path}") relativePaths; - in - absolutePaths - ); - /** Read the contents of a file removing the trailing \n diff --git a/lib/tests/modules/types.nix b/lib/tests/modules/types.nix index e860dbac3319..3127ece89e49 100644 --- a/lib/tests/modules/types.nix +++ b/lib/tests/modules/types.nix @@ -380,7 +380,7 @@ in assert (pathWith { absolute = null; }).description == "path"; assert (pathWith { inStore = false; }).description == "path not in the Nix store"; assert (pathWith { inStore = null; }).description == "path"; - assert (separatedString "").description == "Concatenated string"; + assert (separatedString "").description == "strings concatenated with \"\""; assert (separatedString ",").description == "strings concatenated with \",\""; assert (separatedString "\n").description == ''strings concatenated with "\n"''; assert (separatedString ":").description == "strings concatenated with \":\""; diff --git a/lib/types.nix b/lib/types.nix index ae77c9fcf8cb..4e20492909c7 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -559,11 +559,7 @@ let sep: mkOptionType rec { name = "separatedString"; - description = - if sep == "" then - "Concatenated string" # for types.string. - else - "strings concatenated with ${builtins.toJSON sep}"; + description = "strings concatenated with ${builtins.toJSON sep}"; descriptionClass = "noun"; check = isString; merge = loc: defs: concatStringsSep sep (getValues defs); @@ -578,19 +574,6 @@ let commas = separatedString ","; envVar = separatedString ":"; - # Deprecated; should not be used because it quietly concatenates - # strings, which is usually not what you want. - # We use a lib.warn because `deprecationMessage` doesn't trigger in nested types such as `attrsOf string` - string = - lib.warn - "The type `types.string` is deprecated. See https://github.com/NixOS/nixpkgs/pull/66346 for better alternative types." - ( - separatedString "" - // { - name = "string"; - } - ); - passwdEntry = entryType: addCheck entryType (str: !(hasInfix ":" str || hasInfix "\n" str)) diff --git a/nixos/modules/programs/pay-respects.nix b/nixos/modules/programs/pay-respects.nix index 71d5c8f0e51d..b8fc8e374936 100644 --- a/nixos/modules/programs/pay-respects.nix +++ b/nixos/modules/programs/pay-respects.nix @@ -16,7 +16,7 @@ let mkOption mkPackageOption optionalString - replaceChars + replaceStrings substring toLower types @@ -142,7 +142,7 @@ in description = "The model used by `pay-respects` to generate command corrections."; }; locale = mkOption { - default = toLower (replaceChars [ "_" ] [ "-" ] (substring 0 5 config.i18n.defaultLocale)); + default = toLower (replaceStrings [ "_" ] [ "-" ] (substring 0 5 config.i18n.defaultLocale)); example = "nl-be"; type = str; description = '' diff --git a/pkgs/development/haskell-modules/lib/default.nix b/pkgs/development/haskell-modules/lib/default.nix index b544c80db937..306176d32fc7 100644 --- a/pkgs/development/haskell-modules/lib/default.nix +++ b/pkgs/development/haskell-modules/lib/default.nix @@ -339,12 +339,6 @@ rec { # packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet packagesFromDirectory = compose.packagesFromDirectory; - addOptparseApplicativeCompletionScripts = - exeName: pkg: - lib.warn "addOptparseApplicativeCompletionScripts 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!" ( - compose.__generateOptparseApplicativeCompletion exeName pkg - ); - /* Modify a Haskell package to add shell completion scripts for the given executable produced by it. These completion scripts will be