lib/deprecation: implement aliases for mkRemovedPackageOptionModule

Allows most existing configs to continue building, now with warnings
instead of assertions when the old `plugins.*.*Package` options are
used.

An assertion will still occur if there is a merge conflict, e.g:
`plugins.a.fooPackage = null` and `plugins.b.fooPackage = pkgs.foo`.
This commit is contained in:
Matt Sturgeon 2025-04-14 16:59:35 +01:00
parent ee9655637c
commit d94956e5da
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 93 additions and 10 deletions

View file

@ -47,4 +47,48 @@
))
];
};
# Integration test for `lib.nixvim.deprecation.mkRemovedPackageOptionModule`
removed-package-options =
{
lib,
pkgs,
config,
...
}:
{
test = {
buildNixvim = false;
warnings = expect: [
(expect "count" 2)
(expect "any" "The option `plugins.chatgpt.curlPackage' defined in `")
(expect "any" "has been replaced by `dependencies.curl.enable' and `dependencies.curl.package'.")
(expect "any" "The option `plugins.glow.glowPackage' defined in `")
];
};
plugins.chatgpt.curlPackage = null;
plugins.glow.glowPackage = pkgs.hello;
assertions = [
{
assertion = !lib.elem pkgs.curl config.extraPackages;
message = "Expected curl not to be installed.";
}
{
assertion = config.dependencies.glow.enable;
message = "Expected `dependencies.glow` to be enabled.";
}
{
assertion = lib.elem pkgs.hello config.extraPackages;
message = "Expected hello to be installed.";
}
{
assertion = !lib.elem pkgs.glow config.extraPackages;
message = "Expected glow not to be installed.";
}
];
};
}