From a3fef2aeb4a0a308f2979878be5ab72735cd98dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 30 Dec 2022 20:14:22 +0100 Subject: [PATCH] home-cursor: use `mkRenamedOptionModule` for `xsession.pointerCursor` This hides the obsolete options from the manual and sets reasonable defaults for `x11.enable` and `gtk.enable` so that we don't have to tell the user to enable them. --- modules/config/home-cursor.nix | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/modules/config/home-cursor.nix b/modules/config/home-cursor.nix index d8cbb53903ed..678908aa796c 100644 --- a/modules/config/home-cursor.nix +++ b/modules/config/home-cursor.nix @@ -30,7 +30,10 @@ let x11 = { enable = mkEnableOption '' x11 config generation for - ''; + '' // { + default = config.xsession.enable; + defaultText = literalExpression "config.xsession.enable"; + }; defaultCursor = mkOption { type = types.str; @@ -43,7 +46,10 @@ let gtk = { enable = mkEnableOption '' gtk config generation for - ''; + '' // { + default = config.gtk.enable; + defaultText = literalExpression "config.gtk.enable"; + }; }; }; }; @@ -56,38 +62,27 @@ in { meta.maintainers = [ maintainers.polykernel maintainers.league ]; imports = [ - (mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [ + (mkRenamedOptionModule [ "xsession" "pointerCursor" "package" ] [ "home" "pointerCursor" "package" ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [ + (mkRenamedOptionModule [ "xsession" "pointerCursor" "name" ] [ "home" "pointerCursor" "name" ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [ + (mkRenamedOptionModule [ "xsession" "pointerCursor" "size" ] [ "home" "pointerCursor" "size" ]) - (mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [ + (mkRenamedOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [ "home" "pointerCursor" "x11" "defaultCursor" ]) - - ({ ... }: { - warnings = optional (any (x: - getAttrFromPath - ([ "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.x11.enable` - to generate x11 specific cursor configurations. You can refer to the documentation for more details. - ''; - }) ]; options = {