mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
lib: add deprecated option warning helpers
This commit is contained in:
@@ -177,6 +177,7 @@ import nmtSrc {
|
||||
(
|
||||
[
|
||||
# keep-sorted start case=no numeric=yes
|
||||
./lib/deprecations
|
||||
./lib/generators
|
||||
./lib/types
|
||||
./modules/files
|
||||
|
||||
3
tests/lib/deprecations/default.nix
Normal file
3
tests/lib/deprecations/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
lib-deprecations-warnings = ./warnings.nix;
|
||||
}
|
||||
42
tests/lib/deprecations/warnings.nix
Normal file
42
tests/lib/deprecations/warnings.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
nmt.script =
|
||||
let
|
||||
expected = pkgs.writeText "deprecation-warnings.expected" ''
|
||||
Using `programs.example.settings` as a list is deprecated and will be
|
||||
removed in a future release. Please use `programs.example.settings.items` instead.
|
||||
|
||||
Move list entries under `settings.items`.
|
||||
|
||||
The value "kde6" for `qt.platformTheme.name` is deprecated and will be
|
||||
removed in a future release. Please use "kde" instead.
|
||||
'';
|
||||
|
||||
actual = pkgs.writeText "deprecation-warnings.actual" (
|
||||
lib.hm.deprecations.mkDeprecatedOptionValueWarning {
|
||||
option = [
|
||||
"programs"
|
||||
"example"
|
||||
"settings"
|
||||
];
|
||||
old = "a list";
|
||||
replacement = "`programs.example.settings.items`";
|
||||
details = "Move list entries under `settings.items`.";
|
||||
}
|
||||
+ "\n"
|
||||
+ lib.hm.deprecations.mkDeprecatedOptionValueRenameWarning {
|
||||
option = [
|
||||
"qt"
|
||||
"platformTheme"
|
||||
"name"
|
||||
];
|
||||
old = ''"kde6"'';
|
||||
replacement = ''"kde"'';
|
||||
}
|
||||
);
|
||||
in
|
||||
''
|
||||
assertFileContent ${actual} ${expected}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user