mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +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;
|
literalExpression escapeShellArg hm getAttrFromPath any optional;
|
||||||
|
|
||||||
cfg = config.home.pointerCursor;
|
cfg = config.home.pointerCursor;
|
||||||
|
opts = options.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;
|
|
||||||
|
|
||||||
pointerCursorModule = types.submodule {
|
pointerCursorModule = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -132,10 +124,7 @@ in {
|
||||||
options = {
|
options = {
|
||||||
home.pointerCursor = mkOption {
|
home.pointerCursor = mkOption {
|
||||||
type = types.nullOr pointerCursorModule;
|
type = types.nullOr pointerCursorModule;
|
||||||
default = if (lib.versionOlder config.home.stateVersion "25.05") then
|
default = null;
|
||||||
null
|
|
||||||
else
|
|
||||||
{ };
|
|
||||||
description = ''
|
description = ''
|
||||||
Cursor configuration.
|
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 [
|
(mkIf enable (mkMerge [
|
||||||
{
|
{
|
||||||
assertions = [
|
assertions = [
|
||||||
|
@ -242,12 +237,12 @@ in {
|
||||||
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
|
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
|
||||||
options) [ "package" "name" "size" "defaultCursor" ]) ''
|
options) [ "package" "name" "size" "defaultCursor" ]) ''
|
||||||
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
|
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`
|
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable`
|
||||||
to generate x10 specific cursor configurations. You can refer to the documentation for more details.
|
to generate x11 specific cursor configurations. You can refer to the documentation for more details.
|
||||||
'') ++ (optional ((lib.versionAtLeast config.home.stateVersion "25.05")
|
'') ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority
|
||||||
&& (cfg == null)) ''
|
&& cfg == null) ''
|
||||||
Setting home.pointerCursor to null is deprecated.
|
Setting home.pointerCursor to null is deprecated.
|
||||||
Please update your configuration so that
|
Please update your configuration to explicitly set:
|
||||||
|
|
||||||
home.pointerCursor.enable = false;
|
home.pointerCursor.enable = false;
|
||||||
'');
|
'');
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
config = {
|
config = {
|
||||||
home.pointerCursor = null;
|
home.pointerCursor = null;
|
||||||
|
|
||||||
home.stateVersion = "25.05";
|
home.stateVersion = "24.11";
|
||||||
|
|
||||||
test.asserts.warnings.expected = [''
|
test.asserts.warnings.expected = [''
|
||||||
Setting home.pointerCursor to null is deprecated.
|
Setting home.pointerCursor to null is deprecated.
|
||||||
Please update your configuration so that
|
Please update your configuration to explicitly set:
|
||||||
|
|
||||||
home.pointerCursor.enable = false;
|
home.pointerCursor.enable = false;
|
||||||
''];
|
''];
|
||||||
|
|
Loading…
Add table
Reference in a new issue