mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-16 22:11:07 +01:00
mako: remove criteria
No longer serves a purpose, was short lived and most people are either using `settings` or will use `extraConfig` Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
654b686536
commit
6861cfa165
4 changed files with 18 additions and 143 deletions
|
|
@ -33,10 +33,13 @@ let
|
||||||
|
|
||||||
sectionLines = lib.concatStringsSep "\n" (lib.mapAttrsToList formatSection sectionSettings);
|
sectionLines = lib.concatStringsSep "\n" (lib.mapAttrsToList formatSection sectionSettings);
|
||||||
in
|
in
|
||||||
if sectionSettings != { } then globalLines + "\n" + sectionLines + "\n" else globalLines + "\n";
|
lib.mkMerge [
|
||||||
|
globalLines
|
||||||
|
(lib.mkIf (sectionSettings != { }) sectionLines)
|
||||||
|
(lib.mkIf (cfg.extraConfig != "") ("\n" + cfg.extraConfig))
|
||||||
|
];
|
||||||
|
|
||||||
iniFormat = pkgs.formats.ini { };
|
iniFormat = pkgs.formats.ini { };
|
||||||
iniType = iniFormat.type;
|
|
||||||
iniAtomType = iniFormat.lib.types.atom;
|
iniAtomType = iniFormat.lib.types.atom;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
@ -82,9 +85,13 @@ in
|
||||||
(lib.mkRemovedOptionModule [
|
(lib.mkRemovedOptionModule [
|
||||||
"services"
|
"services"
|
||||||
"mako"
|
"mako"
|
||||||
"extraConfig"
|
"criterias"
|
||||||
] "Use services.mako.settings instead.")
|
] "Use services.mako.settings instead. If order is important, use `services.mako.extraConfig`.")
|
||||||
(lib.mkRenamedOptionModule [ "services" "mako" "criterias" ] [ "services" "mako" "criteria" ])
|
(lib.mkRemovedOptionModule [
|
||||||
|
"services"
|
||||||
|
"mako"
|
||||||
|
"criteria"
|
||||||
|
] "Use services.mako.settings instead. If order is important, use `services.mako.extraConfig`.")
|
||||||
]
|
]
|
||||||
++ lib.hm.deprecations.mkSettingsRenamedOptionModules basePath (basePath ++ [ "settings" ]) {
|
++ lib.hm.deprecations.mkSettingsRenamedOptionModules basePath (basePath ++ [ "settings" ]) {
|
||||||
transform = lib.hm.strings.toKebabCase;
|
transform = lib.hm.strings.toKebabCase;
|
||||||
|
|
@ -130,41 +137,6 @@ in
|
||||||
<https://github.com/emersion/mako/blob/master/doc/mako.5.scd>.
|
<https://github.com/emersion/mako/blob/master/doc/mako.5.scd>.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
criteria = mkOption {
|
|
||||||
visible = false;
|
|
||||||
type = iniType;
|
|
||||||
default = { };
|
|
||||||
example = {
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
|
|
||||||
"app-name=Google\\ Chrome" = {
|
|
||||||
max-visible = "5";
|
|
||||||
};
|
|
||||||
|
|
||||||
"field1=value field2=value" = {
|
|
||||||
text-alignment = "left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
description = ''
|
|
||||||
Criteria for mako's config. All the details can be found in the
|
|
||||||
CRITERIA section in the official documentation.
|
|
||||||
|
|
||||||
*Deprecated*: Use `settings` with nested attributes instead. For example:
|
|
||||||
```nix
|
|
||||||
settings = {
|
|
||||||
# Global settings
|
|
||||||
anchor = "top-right";
|
|
||||||
|
|
||||||
# Criteria sections
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
type = lib.types.lines;
|
type = lib.types.lines;
|
||||||
|
|
@ -172,7 +144,7 @@ in
|
||||||
[urgency=low]
|
[urgency=low]
|
||||||
border-color=#b8bb26
|
border-color=#b8bb26
|
||||||
'';
|
'';
|
||||||
description = "Additional configuration.";
|
description = "Additional configuration lines to inject directly into the generated config file.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -181,44 +153,13 @@ in
|
||||||
(lib.hm.assertions.assertPlatform "services.mako" pkgs lib.platforms.linux)
|
(lib.hm.assertions.assertPlatform "services.mako" pkgs lib.platforms.linux)
|
||||||
];
|
];
|
||||||
|
|
||||||
warnings = lib.optional (cfg.criteria != { }) ''
|
|
||||||
The option `services.mako.criteria` is deprecated and will be removed in a future release.
|
|
||||||
Please use `services.mako.settings` with nested attributes instead.
|
|
||||||
|
|
||||||
For example, instead of:
|
|
||||||
criteria = {
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Use:
|
|
||||||
settings = {
|
|
||||||
# Global settings here...
|
|
||||||
|
|
||||||
# Criteria sections
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
|
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
dbus.packages = [ cfg.package ];
|
dbus.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."mako/config" =
|
xdg.configFile."mako/config" = mkIf (cfg.settings != { } || cfg.extraConfig != "") {
|
||||||
mkIf (cfg.settings != { } || cfg.criteria != { } || cfg.extraConfig != "")
|
|
||||||
{
|
|
||||||
onChange = "${cfg.package}/bin/makoctl reload || true";
|
onChange = "${cfg.package}/bin/makoctl reload || true";
|
||||||
text =
|
text = generateConfig cfg.settings;
|
||||||
let
|
|
||||||
# Merge settings and criteria into a single attribute set
|
|
||||||
# where settings are at the top level and criteria are nested attributes
|
|
||||||
mergedConfig = cfg.settings // cfg.criteria;
|
|
||||||
generatedConfig = generateConfig mergedConfig;
|
|
||||||
in
|
|
||||||
if cfg.extraConfig != "" then generatedConfig + cfg.extraConfig + "\n" else generatedConfig;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
mako-example-config = ./example-config.nix;
|
mako-example-config = ./example-config.nix;
|
||||||
mako-deprecated-criteria = ./deprecated-criteria.nix;
|
|
||||||
mako-renamed-options = ./renamed-options.nix;
|
mako-renamed-options = ./renamed-options.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
{
|
|
||||||
services.mako = {
|
|
||||||
enable = true;
|
|
||||||
# Global settings
|
|
||||||
settings = {
|
|
||||||
actions = true;
|
|
||||||
anchor = "top-right";
|
|
||||||
background-color = "#000000";
|
|
||||||
border-color = "#FFFFFF";
|
|
||||||
border-radius = 0;
|
|
||||||
default-timeout = 0;
|
|
||||||
font = "monospace 10";
|
|
||||||
height = 100;
|
|
||||||
width = 300;
|
|
||||||
icons = true;
|
|
||||||
ignore-timeout = false;
|
|
||||||
layer = "top";
|
|
||||||
margin = 10;
|
|
||||||
markup = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Using deprecated criteria option
|
|
||||||
criteria = {
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
"app-name=Google\\ Chrome" = {
|
|
||||||
max-visible = 5;
|
|
||||||
};
|
|
||||||
"field1=value field2=value" = {
|
|
||||||
text-alignment = "left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
test.asserts.warnings.expected = [
|
|
||||||
''
|
|
||||||
The option `services.mako.criteria` is deprecated and will be removed in a future release.
|
|
||||||
Please use `services.mako.settings` with nested attributes instead.
|
|
||||||
|
|
||||||
For example, instead of:
|
|
||||||
criteria = {
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
Use:
|
|
||||||
settings = {
|
|
||||||
# Global settings here...
|
|
||||||
|
|
||||||
# Criteria sections
|
|
||||||
"actionable=true" = {
|
|
||||||
anchor = "top-left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
''
|
|
||||||
];
|
|
||||||
|
|
||||||
nmt.script = ''
|
|
||||||
assertFileExists home-files/.config/mako/config
|
|
||||||
assertFileContent home-files/.config/mako/config \
|
|
||||||
${./config}
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue