mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-20 23:30:07 +00:00
home-cursor: louder deprecation
Check if a user explicitly set option to null and warn that they should just disable instead.
This commit is contained in:
parent
74f2ed6a64
commit
1878091234
2 changed files with 16 additions and 21 deletions
|
@ -6,15 +6,7 @@ let
|
|||
literalExpression escapeShellArg hm getAttrFromPath any optional;
|
||||
|
||||
cfg = config.home.pointerCursor;
|
||||
|
||||
enable = if (lib.versionOlder config.home.stateVersion "25.05") then
|
||||
# respect .enable if it is declared
|
||||
if (any (x: x ? enable) options.home.pointerCursor.definitions) then
|
||||
cfg.enable
|
||||
else
|
||||
cfg != null
|
||||
else
|
||||
(cfg ? enable) && cfg.enable;
|
||||
opts = options.home.pointerCursor;
|
||||
|
||||
pointerCursorModule = types.submodule {
|
||||
options = {
|
||||
|
@ -132,10 +124,7 @@ in {
|
|||
options = {
|
||||
home.pointerCursor = mkOption {
|
||||
type = types.nullOr pointerCursorModule;
|
||||
default = if (lib.versionOlder config.home.stateVersion "25.05") then
|
||||
null
|
||||
else
|
||||
{ };
|
||||
default = null;
|
||||
description = ''
|
||||
Cursor configuration.
|
||||
|
||||
|
@ -156,7 +145,13 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
config = let
|
||||
# Check if enable option was explicitly defined by the user
|
||||
enableDefined = any (x: x ? enable) opts.definitions;
|
||||
|
||||
# Determine if cursor configuration should be enabled
|
||||
enable = if enableDefined then cfg.enable else cfg != null;
|
||||
in mkMerge [
|
||||
(mkIf enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
|
@ -242,12 +237,12 @@ in {
|
|||
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
|
||||
options) [ "package" "name" "size" "defaultCursor" ]) ''
|
||||
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
|
||||
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x10.enable`
|
||||
to generate x10 specific cursor configurations. You can refer to the documentation for more details.
|
||||
'') ++ (optional ((lib.versionAtLeast config.home.stateVersion "25.05")
|
||||
&& (cfg == null)) ''
|
||||
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable`
|
||||
to generate x11 specific cursor configurations. You can refer to the documentation for more details.
|
||||
'') ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority
|
||||
&& cfg == null) ''
|
||||
Setting home.pointerCursor to null is deprecated.
|
||||
Please update your configuration so that
|
||||
Please update your configuration to explicitly set:
|
||||
|
||||
home.pointerCursor.enable = false;
|
||||
'');
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
config = {
|
||||
home.pointerCursor = null;
|
||||
|
||||
home.stateVersion = "25.05";
|
||||
home.stateVersion = "24.11";
|
||||
|
||||
test.asserts.warnings.expected = [''
|
||||
Setting home.pointerCursor to null is deprecated.
|
||||
Please update your configuration so that
|
||||
Please update your configuration to explicitly set:
|
||||
|
||||
home.pointerCursor.enable = false;
|
||||
''];
|
||||
|
|
Loading…
Add table
Reference in a new issue