mise: remove the settings option
mise no longer supports the separate `settings.toml` file for settings. Settings should be defined in the global configuration (`globalConfig`).
This commit is contained in:
parent
1dc235b2fb
commit
360620ec9d
5 changed files with 83 additions and 48 deletions
|
|
@ -14,15 +14,20 @@ in
|
|||
|
||||
imports =
|
||||
let
|
||||
mkRemovedWarning =
|
||||
mkRtxRemovedWarning =
|
||||
opt:
|
||||
(lib.mkRemovedOptionModule [ "programs" "rtx" opt ] ''
|
||||
The `rtx` package has been replaced by `mise`, please switch over to
|
||||
using the options under `programs.mise.*` instead.
|
||||
'');
|
||||
|
||||
in
|
||||
map mkRemovedWarning [
|
||||
[
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "programs" "mise" "settings" ]
|
||||
[ "programs" "mise" "globalConfig" "settings" ]
|
||||
)
|
||||
]
|
||||
++ map mkRtxRemovedWarning [
|
||||
"enable"
|
||||
"package"
|
||||
"enableBashIntegration"
|
||||
|
|
@ -47,38 +52,32 @@ in
|
|||
enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; };
|
||||
|
||||
globalConfig = mkOption {
|
||||
type = tomlFormat.type;
|
||||
inherit (tomlFormat) type;
|
||||
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
settings = {
|
||||
disable_tools = [ "node" ];
|
||||
experimental = true;
|
||||
verbose = false;
|
||||
};
|
||||
|
||||
tool_alias = {
|
||||
node.versions = {
|
||||
my_custom_node = "20";
|
||||
};
|
||||
};
|
||||
|
||||
tools = {
|
||||
node = "lts";
|
||||
python = ["3.10" "3.11"];
|
||||
};
|
||||
|
||||
aliases = {
|
||||
my_custom_node = "20";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Config written to {file}`$XDG_CONFIG_HOME/mise/config.toml`.
|
||||
|
||||
See <https://mise.jdx.dev/configuration.html#global-config-config-mise-config-toml>
|
||||
for details on supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
verbose = false;
|
||||
experimental = false;
|
||||
disable_tools = ["node"];
|
||||
'';
|
||||
description = ''
|
||||
Settings written to {file}`$XDG_CONFIG_HOME/mise/settings.toml`.
|
||||
|
||||
See <https://mise.jdx.dev/configuration.html#settings-file-config-mise-settings-toml>
|
||||
See <https://mise.jdx.dev/configuration.html> and
|
||||
<https://mise.jdx.dev/configuration/settings.html>
|
||||
for details on supported values.
|
||||
'';
|
||||
};
|
||||
|
|
@ -109,10 +108,6 @@ in
|
|||
"mise/config.toml" = mkIf (cfg.globalConfig != { }) {
|
||||
source = tomlFormat.generate "mise-config" cfg.globalConfig;
|
||||
};
|
||||
|
||||
"mise/settings.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "mise-settings" cfg.settings;
|
||||
};
|
||||
};
|
||||
|
||||
programs = {
|
||||
|
|
|
|||
35
tests/modules/programs/mise/custom-settings-renamed.nix
Normal file
35
tests/modules/programs/mise/custom-settings-renamed.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs = {
|
||||
mise = {
|
||||
package = config.lib.test.mkStubPackage { name = "mise"; };
|
||||
enable = true;
|
||||
settings = {
|
||||
disable_tools = [ "node" ];
|
||||
experimental = true;
|
||||
verbose = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"The option `programs.mise.settings' defined in ${lib.showFiles options.programs.mise.settings.files} has been renamed to `programs.mise.globalConfig.settings'."
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/mise/config.toml
|
||||
|
||||
assertFileContent home-files/.config/mise/config.toml ${pkgs.writeText "mise.config.expected" ''
|
||||
[settings]
|
||||
disable_tools = ["node"]
|
||||
experimental = true
|
||||
verbose = false
|
||||
''}
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,10 +1,26 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs = {
|
||||
mise = {
|
||||
package = config.lib.test.mkStubPackage { name = "mise"; };
|
||||
enable = true;
|
||||
globalConfig = {
|
||||
settings = {
|
||||
disable_tools = [ "node" ];
|
||||
experimental = true;
|
||||
verbose = false;
|
||||
};
|
||||
|
||||
tool_alias = {
|
||||
node.versions = {
|
||||
my_custom_node = "20";
|
||||
};
|
||||
};
|
||||
|
||||
tools = {
|
||||
node = "lts";
|
||||
python = [
|
||||
|
|
@ -12,36 +28,25 @@
|
|||
"3.11"
|
||||
];
|
||||
};
|
||||
|
||||
aliases = {
|
||||
my_custom_node = "20";
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
verbose = false;
|
||||
experimental = true;
|
||||
disable_tools = [ "node" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/mise/config.toml
|
||||
assertFileExists home-files/.config/mise/settings.toml
|
||||
|
||||
assertFileContent home-files/.config/mise/config.toml ${pkgs.writeText "mise.config.expected" ''
|
||||
[aliases]
|
||||
[settings]
|
||||
disable_tools = ["node"]
|
||||
experimental = true
|
||||
verbose = false
|
||||
|
||||
[tool_alias.node.versions]
|
||||
my_custom_node = "20"
|
||||
|
||||
[tools]
|
||||
node = "lts"
|
||||
python = ["3.10", "3.11"]
|
||||
''}
|
||||
|
||||
assertFileContent home-files/.config/mise/settings.toml ${pkgs.writeText "mise.settings.expected" ''
|
||||
disable_tools = ["node"]
|
||||
experimental = true
|
||||
verbose = false
|
||||
''}
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/mise/config.toml
|
||||
assertPathNotExists home-files/.config/mise/settings.toml
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
mise-default-settings = ./default-settings.nix;
|
||||
mise-custom-settings = ./custom-settings.nix;
|
||||
mise-custom-settings-renamed = ./custom-settings-renamed.nix;
|
||||
mise-bash-integration = ./bash-integration.nix;
|
||||
mise-zsh-integration = ./zsh-integration.nix;
|
||||
mise-fish-integration = ./fish-integration.nix;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue