mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
treewide: remove deprecated lib functions that had warning for more than 2 years
This commit is contained in:
parent
7d909d8d02
commit
dc7095a86e
|
|
@ -342,16 +342,32 @@
|
||||||
|
|
||||||
### Breaking changes {#sec-nixpkgs-release-25.11-lib-breaking}
|
### 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.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.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.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.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.
|
- `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
|
- The `buildPythonPackage` and `buildPythonApplication` functions now require
|
||||||
an explicit `format` attribute. Previously the default format used setuptools
|
an explicit `format` attribute. Previously the default format used setuptools
|
||||||
and called `setup.py` from the source tree, which is deprecated.
|
and called `setup.py` from the source tree, which is deprecated.
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ let
|
||||||
filterAttrs
|
filterAttrs
|
||||||
optionalString
|
optionalString
|
||||||
flip
|
flip
|
||||||
pathIsDirectory
|
|
||||||
head
|
head
|
||||||
pipe
|
pipe
|
||||||
isDerivation
|
isDerivation
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,6 @@ let
|
||||||
escapeRegex
|
escapeRegex
|
||||||
escapeURL
|
escapeURL
|
||||||
escapeXML
|
escapeXML
|
||||||
replaceChars
|
|
||||||
lowerChars
|
lowerChars
|
||||||
upperChars
|
upperChars
|
||||||
toLower
|
toLower
|
||||||
|
|
@ -377,7 +376,6 @@ let
|
||||||
fixedWidthNumber
|
fixedWidthNumber
|
||||||
toInt
|
toInt
|
||||||
toIntBase10
|
toIntBase10
|
||||||
readPathsFromFile
|
|
||||||
fileContents
|
fileContents
|
||||||
;
|
;
|
||||||
inherit (self.stringsWithDeps)
|
inherit (self.stringsWithDeps)
|
||||||
|
|
@ -495,7 +493,6 @@ let
|
||||||
optionAttrSetToDocList'
|
optionAttrSetToDocList'
|
||||||
scrubOptionValue
|
scrubOptionValue
|
||||||
literalExpression
|
literalExpression
|
||||||
literalExample
|
|
||||||
showOption
|
showOption
|
||||||
showOptionWithDefLocs
|
showOptionWithDefLocs
|
||||||
showFiles
|
showFiles
|
||||||
|
|
|
||||||
|
|
@ -1468,11 +1468,6 @@ let
|
||||||
mkForce = mkOverride 50;
|
mkForce = mkOverride 50;
|
||||||
mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’
|
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;
|
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: {
|
mkOrder = priority: content: {
|
||||||
|
|
@ -2162,7 +2157,6 @@ private
|
||||||
inherit
|
inherit
|
||||||
defaultOrderPriority
|
defaultOrderPriority
|
||||||
defaultOverridePriority
|
defaultOverridePriority
|
||||||
defaultPriority
|
|
||||||
doRename
|
doRename
|
||||||
evalModules
|
evalModules
|
||||||
evalOptionValue # for use by lib.types
|
evalOptionValue # for use by lib.types
|
||||||
|
|
|
||||||
|
|
@ -684,8 +684,6 @@ rec {
|
||||||
inherit text;
|
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
|
For use in the `defaultText` and `example` option attributes. Causes the
|
||||||
given MD text to be inserted verbatim in the documentation, for when
|
given MD text to be inserted verbatim in the documentation, for when
|
||||||
|
|
|
||||||
|
|
@ -509,22 +509,6 @@ let
|
||||||
|
|
||||||
in
|
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
|
inherit
|
||||||
pathIsGitRepo
|
pathIsGitRepo
|
||||||
commitIdFromGitRepo
|
commitIdFromGitRepo
|
||||||
|
|
|
||||||
|
|
@ -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.
|
# Case conversion utilities.
|
||||||
lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";
|
lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";
|
||||||
upperChars = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
upperChars = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
@ -2578,30 +2575,6 @@ rec {
|
||||||
in
|
in
|
||||||
lib.warnIf (!precise) "Imprecise conversion from float to string ${result}" result;
|
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.
|
Check whether a list or other value `x` can be passed to toString.
|
||||||
|
|
||||||
|
|
@ -2842,60 +2815,6 @@ rec {
|
||||||
else
|
else
|
||||||
parsedInput;
|
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
|
Read the contents of a file removing the trailing \n
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -380,7 +380,7 @@ in
|
||||||
assert (pathWith { absolute = null; }).description == "path";
|
assert (pathWith { absolute = null; }).description == "path";
|
||||||
assert (pathWith { inStore = false; }).description == "path not in the Nix store";
|
assert (pathWith { inStore = false; }).description == "path not in the Nix store";
|
||||||
assert (pathWith { inStore = null; }).description == "path";
|
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 ",").description == "strings concatenated with \",\"";
|
||||||
assert (separatedString "\n").description == ''strings concatenated with "\n"'';
|
assert (separatedString "\n").description == ''strings concatenated with "\n"'';
|
||||||
assert (separatedString ":").description == "strings concatenated with \":\"";
|
assert (separatedString ":").description == "strings concatenated with \":\"";
|
||||||
|
|
|
||||||
|
|
@ -559,11 +559,7 @@ let
|
||||||
sep:
|
sep:
|
||||||
mkOptionType rec {
|
mkOptionType rec {
|
||||||
name = "separatedString";
|
name = "separatedString";
|
||||||
description =
|
description = "strings concatenated with ${builtins.toJSON sep}";
|
||||||
if sep == "" then
|
|
||||||
"Concatenated string" # for types.string.
|
|
||||||
else
|
|
||||||
"strings concatenated with ${builtins.toJSON sep}";
|
|
||||||
descriptionClass = "noun";
|
descriptionClass = "noun";
|
||||||
check = isString;
|
check = isString;
|
||||||
merge = loc: defs: concatStringsSep sep (getValues defs);
|
merge = loc: defs: concatStringsSep sep (getValues defs);
|
||||||
|
|
@ -578,19 +574,6 @@ let
|
||||||
commas = separatedString ",";
|
commas = separatedString ",";
|
||||||
envVar = 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 =
|
passwdEntry =
|
||||||
entryType:
|
entryType:
|
||||||
addCheck entryType (str: !(hasInfix ":" str || hasInfix "\n" str))
|
addCheck entryType (str: !(hasInfix ":" str || hasInfix "\n" str))
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ let
|
||||||
mkOption
|
mkOption
|
||||||
mkPackageOption
|
mkPackageOption
|
||||||
optionalString
|
optionalString
|
||||||
replaceChars
|
replaceStrings
|
||||||
substring
|
substring
|
||||||
toLower
|
toLower
|
||||||
types
|
types
|
||||||
|
|
@ -142,7 +142,7 @@ in
|
||||||
description = "The model used by `pay-respects` to generate command corrections.";
|
description = "The model used by `pay-respects` to generate command corrections.";
|
||||||
};
|
};
|
||||||
locale = mkOption {
|
locale = mkOption {
|
||||||
default = toLower (replaceChars [ "_" ] [ "-" ] (substring 0 5 config.i18n.defaultLocale));
|
default = toLower (replaceStrings [ "_" ] [ "-" ] (substring 0 5 config.i18n.defaultLocale));
|
||||||
example = "nl-be";
|
example = "nl-be";
|
||||||
type = str;
|
type = str;
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
||||||
|
|
@ -339,12 +339,6 @@ rec {
|
||||||
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
|
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
|
||||||
packagesFromDirectory = compose.packagesFromDirectory;
|
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
|
Modify a Haskell package to add shell completion scripts for the
|
||||||
given executable produced by it. These completion scripts will be
|
given executable produced by it. These completion scripts will be
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue