Skip to content

Commit a26ef76

Browse files
committed
home-cursor: louder deprecation
Check if a user explicitly set option to null and warn that they should just disable instead.
1 parent 494f66b commit a26ef76

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

modules/config/home-cursor.nix

+14-19
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ let
66
literalExpression escapeShellArg hm getAttrFromPath any optional;
77

88
cfg = config.home.pointerCursor;
9-
10-
enable = if (lib.versionOlder config.home.stateVersion "25.05") then
11-
# respect .enable if it is declared
12-
if (any (x: x ? enable) options.home.pointerCursor.definitions) then
13-
cfg.enable
14-
else
15-
cfg != null
16-
else
17-
(cfg ? enable) && cfg.enable;
9+
opts = options.home.pointerCursor;
1810

1911
pointerCursorModule = types.submodule {
2012
options = {
@@ -132,10 +124,7 @@ in {
132124
options = {
133125
home.pointerCursor = mkOption {
134126
type = types.nullOr pointerCursorModule;
135-
default = if (lib.versionOlder config.home.stateVersion "25.05") then
136-
null
137-
else
138-
{ };
127+
default = null;
139128
description = ''
140129
Cursor configuration.
141130
@@ -156,7 +145,13 @@ in {
156145
};
157146
};
158147

159-
config = mkMerge [
148+
config = let
149+
# Check if enable option was explicitly defined by the user
150+
enableDefined = any (x: x ? enable) opts.definitions;
151+
152+
# Determine if cursor configuration should be enabled
153+
enable = if enableDefined then cfg.enable else cfg != null;
154+
in mkMerge [
160155
(mkIf enable (mkMerge [
161156
{
162157
assertions = [
@@ -242,12 +237,12 @@ in {
242237
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
243238
options) [ "package" "name" "size" "defaultCursor" ]) ''
244239
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
245-
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x10.enable`
246-
to generate x10 specific cursor configurations. You can refer to the documentation for more details.
247-
'') ++ (optional ((lib.versionAtLeast config.home.stateVersion "25.05")
248-
&& (cfg == null)) ''
240+
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable`
241+
to generate x11 specific cursor configurations. You can refer to the documentation for more details.
242+
'') ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority
243+
&& cfg == null) ''
249244
Setting home.pointerCursor to null is deprecated.
250-
Please update your configuration so that
245+
Please update your configuration to explicitly set:
251246
252247
home.pointerCursor.enable = false;
253248
'');

tests/modules/config/home-cursor/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
config = {
3333
home.pointerCursor = null;
3434

35-
home.stateVersion = "25.05";
35+
home.stateVersion = "24.11";
3636

3737
test.asserts.warnings.expected = [''
3838
Setting home.pointerCursor to null is deprecated.
39-
Please update your configuration so that
39+
Please update your configuration to explicitly set:
4040
4141
home.pointerCursor.enable = false;
4242
''];

0 commit comments

Comments
 (0)