2.home-manager/tests/modules/config/home-cursor/default.nix
Austin Horstman 1aac8895fe home-cursor: warn before removing implicit enable
Follow up on home-cursor: remove legacy enable by preserving the implicit enable path that was not covered by the earlier deprecation warning.

Configurations that set home.pointerCursor without top-level enable now continue to work and emit a warning asking users to set home.pointerCursor.enable explicitly.
2026-07-08 10:46:52 -05:00

172 lines
5.4 KiB
Nix

let
package = {
buildScript = ''
mkdir -p $out/share/icons/catppuccin-macchiato-blue-cursors
echo test > $out/share/icons/catppuccin-macchiato-blue-cursors/index.theme
'';
};
in
{
home-cursor-no-config = {
nmt.script = ''
assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="64"'
'';
};
# Ensure backwards compatibility with existing configs
home-cursor-legacy =
{ config, ... }:
{
config = {
home.pointerCursor = {
name = "catppuccin-macchiato-blue-standard";
package = config.lib.test.mkStubPackage package;
size = 64;
gtk.enable = true;
x11.enable = true;
};
home.stateVersion = "24.11";
test.asserts.warnings.expected = [
''
Relying on `home.pointerCursor` to enable cursor config generation is deprecated.
Please update your configuration to explicitly set:
home.pointerCursor.enable = true;
''
];
nmt.script = ''
assertFileExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileRegex $hmEnvFile 'XCURSOR_SIZE="64"'
'';
};
};
home-cursor-legacy-disabled-with-enable =
{ config, ... }:
{
config = {
home.pointerCursor = {
enable = false;
package = config.lib.test.mkStubPackage package;
name = "catppuccin-macchiato-blue-standard";
size = 64;
gtk.enable = true;
hyprcursor.enable = true;
x11.enable = true;
};
home.stateVersion = "24.11";
nmt.script = ''
assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="32"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_SIZE="32"'
'';
};
};
home-cursor-legacy-enabled-with-enable =
{ config, ... }:
{
config = {
home.pointerCursor = {
enable = true;
package = config.lib.test.mkStubPackage package;
name = "catppuccin-macchiato-blue-standard";
size = 64;
gtk.enable = true;
hyprcursor.enable = true;
x11.enable = true;
};
home.stateVersion = "24.11";
nmt.script = ''
assertFileExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileRegex $hmEnvFile 'XCURSOR_SIZE="64"'
assertFileRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileRegex $hmEnvFile 'HYPRCURSOR_SIZE="64"'
'';
};
};
home-cursor =
{ config, ... }:
{
config = {
home.pointerCursor = {
enable = true;
package = config.lib.test.mkStubPackage package;
name = "catppuccin-macchiato-blue-standard";
size = 64;
gtk.enable = true;
hyprcursor.enable = true;
x11.enable = true;
};
home.stateVersion = "25.05";
nmt.script = ''
assertFileExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileRegex $hmEnvFile 'XCURSOR_SIZE="64"'
assertFileRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileRegex $hmEnvFile 'HYPRCURSOR_SIZE="64"'
'';
};
};
home-cursor-disabled =
{ config, ... }:
{
config = {
home.pointerCursor = {
enable = false;
package = config.lib.test.mkStubPackage package;
name = "catppuccin-macchiato-blue-standard";
size = 64;
gtk.enable = true;
hyprcursor.enable = true;
x11.enable = true;
};
home.stateVersion = "25.05";
nmt.script = ''
assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="32"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_SIZE="32"'
'';
};
};
}