mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
helix: assert languages migration warning
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
@@ -85,17 +86,9 @@ in
|
||||
languages = mkOption {
|
||||
type =
|
||||
with types;
|
||||
coercedTo (listOf tomlFormat.type) (
|
||||
language:
|
||||
lib.warn ''
|
||||
The syntax of programs.helix.languages has changed.
|
||||
It now generates the whole languages.toml file instead of just the language array in that file.
|
||||
|
||||
Use
|
||||
programs.helix.languages = { language = <languages list>; }
|
||||
instead.
|
||||
'' { inherit language; }
|
||||
) (addCheck tomlFormat.type builtins.isAttrs);
|
||||
coercedTo (listOf tomlFormat.type) (language: { inherit language; }) (
|
||||
addCheck tomlFormat.type builtins.isAttrs
|
||||
);
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
@@ -210,6 +203,24 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings = lib.optional (lib.any builtins.isList options.programs.helix.languages.definitions) (
|
||||
lib.hm.deprecations.mkDeprecatedOptionValueWarning {
|
||||
option = [
|
||||
"programs"
|
||||
"helix"
|
||||
"languages"
|
||||
];
|
||||
old = "a list";
|
||||
replacement = "`programs.helix.languages.language`";
|
||||
details = ''
|
||||
This option now generates the whole languages.toml file instead of just the language array in that file.
|
||||
|
||||
Use:
|
||||
programs.helix.languages = { language = <languages list>; }
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
home.packages =
|
||||
if cfg.extraPackages != [ ] then
|
||||
[
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
helix-example-settings = ./example-settings.nix;
|
||||
helix-legacy-languages = ./legacy-languages.nix;
|
||||
helix-only-extraconfig = ./only-extraconfig.nix;
|
||||
}
|
||||
|
||||
57
tests/modules/programs/helix/legacy-languages.nix
Normal file
57
tests/modules/programs/helix/legacy-languages.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
# Exercise merging legacy list definitions with new attrset definitions.
|
||||
imports = [
|
||||
{
|
||||
programs.helix.languages.language-server.nil = {
|
||||
command = "nil";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { outPath = "@helix@"; };
|
||||
languages = [
|
||||
{
|
||||
name = "rust";
|
||||
auto-format = false;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
''
|
||||
Using `programs.helix.languages` as a list is deprecated and will be
|
||||
removed in a future release. Please use `programs.helix.languages.language` instead.
|
||||
|
||||
This option now generates the whole languages.toml file instead of just the language array in that file.
|
||||
|
||||
Use:
|
||||
programs.helix.languages = { language = <languages list>; }
|
||||
|
||||
''
|
||||
];
|
||||
|
||||
nmt.script =
|
||||
let
|
||||
expectedLanguages = pkgs.writeText "helix-languages.expected.toml" ''
|
||||
[[language]]
|
||||
auto-format = false
|
||||
name = "rust"
|
||||
|
||||
[language-server.nil]
|
||||
command = "nil"
|
||||
'';
|
||||
in
|
||||
''
|
||||
assertFileContent \
|
||||
home-files/.config/helix/languages.toml \
|
||||
${expectedLanguages}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user