Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-cursor: modernize #6492

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

isabelroses
Copy link
Contributor

Description

Added the .enable pattern to home.pointerCursor for the selfish reason that is https://github.com/catppuccin/nix/blob/24dac16e6babd41961d985eef3dce6a30dab2e91/modules/home-manager/cursors.nix#L26-L27.

And made the .icons directory "toggleable" via home.pointerCursor.doticons.enable. Which in my opinion is easier than writing:

{
  lib,
  config,
  ...
}:
{
  home.file = lib.mkIf (config.home.pointerCursor != null) {
    ".icons/default/index.theme".enable = false;
    ".icons/${config.home.pointerCursor.name}".enable = false;
  };
}

And removing the top-level with lib

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all
    or nix build --reference-lock-file flake.lock ./tests#test-all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch from db7301a to a57eb96 Compare February 18, 2025 23:10
@isabelroses isabelroses changed the title home-cursor: explicit lib usage home-cursor: modernize Feb 18, 2025
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch 5 times, most recently from 79c7a05 to ec5280c Compare February 19, 2025 17:50
@khaneliman khaneliman mentioned this pull request Feb 19, 2025
6 tasks
@rycee
Copy link
Member

rycee commented Feb 19, 2025

See 797fbbf for a prior example of introducing an enable option. That commit misses to include the change in the release notes, however. Since it is a state version change, it should be included in the 25.05 release notes.

@@ -46,6 +50,14 @@ let
'';
};

doticons = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
doticons = {
dotIcons = {

@@ -46,6 +50,14 @@ let
'';
};

doticons = {
enable = mkEnableOption ''
doticons config generation for {option}`home.pointerCursor`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
doticons config generation for {option}`home.pointerCursor`
`.icons` config generation for {option}`home.pointerCursor`

@khaneliman
Copy link
Collaborator

Sorry, I've been slow to respond because I've been thinking through the silent stateVersion changes you've been doing vs the louder warnings to inform about the deprecations I would have expected. Originally, I expected us to add test.assert.warnings.expected to the legacy test and not need them in the modern test case.

But, maybe this is a good approach to not confuse / burden users with internal details and only new configurations have to deal with the new schema... just worried about tech debt longterm if we have to gate every change and keep it backwards compatible like that.

@isabelroses
Copy link
Contributor Author

just worried about tech debt longterm if we have to gate every change and keep it backwards compatible like that.

The tech debt is great in my opinion too. See https://github.com/catppuccin/nix/blob/b1ff2a638afa827f1473498190a2c1cae1cf41cf/modules/home-manager/swaylock.nix#L13-L26. I see the point of stateVersion but I am not a fan and would prefer to break configs, but I also see not many people have time to fix these things. I would prefer a middle ground but submodules make it very difficult. Perhaps we can remove the submodule somehow.

@ambroisie
Copy link
Contributor

Originally, I expected us to add test.assert.warnings.expected to the legacy test and not need them in the modern test case

👍 this would be my expectation, and the easiest way to on-board users onto the new options.


just worried about tech debt longterm if we have to gate every change and keep it backwards compatible like that.

The tech debt is great in my opinion too

[I] would prefer to break configs

You can (and you should), much the same NixOS does it: support the legacy option for one release, while deprecating it loudly, and removing it at the next branch-off. Given that home manager follows NixOS' release schedule and stateVersions, it should be very familiar to users.

@khaneliman
Copy link
Collaborator

khaneliman commented Feb 23, 2025

Yes, sorry if I wasn't clear. I meant I'd like a loud deprecation with a stable release support. But, not gate everything silently forever with stateVersion checks, making the code base full of crazy conditions that we can't properly remove. We don't need to break a config, if we do it correctly.

I think the main thing we want here is a warning when we detect an option default priority of null for the enable option while they have a configuration that isn't empty. That way, users who have the current behavior of enabling the module via configuration would be notified to either enable or disable explicitly.

Something like this? Not sure if we need to even check that closely or we can just check for null.

options.enable.highestPrio == (lib.mkOptionDefault null).priority

@isabelroses
Copy link
Contributor Author

Something like this? Not sure if we need to even check that closely or we can just check for null.

options.enable.highestPrio == (lib.mkOptionDefault null).priority

Since its a submodule you cannot access outside of the submodule the options.enable or at least to my knowledge.

@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch from df5bd38 to 50aba5b Compare February 23, 2025 23:45
@@ -28,11 +44,11 @@
};
};

home-cursor-legacy-disabled = { ... }: {
home-cursor-disabled = { ... }: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was supposed to be a test that expects the warning with a new one created that doesn't throw the warning when disabled properly.

@@ -1,8 +1,24 @@
{
# Ensure backwards compatibility with existing configs
home-cursor-legacy = { realPkgs, ... }: {
home-cursor-legacy = { ... }: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was supposed to be the test that works with setting a config without enable and threw a warning that the behavior was deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants