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

Merged
merged 5 commits into from
Mar 12, 2025

Conversation

isabelroses
Copy link
Contributor

@isabelroses isabelroses commented Feb 18, 2025

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;
  };
}

partially addresses #6268

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.

@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
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch 2 times, most recently from b7eb33b to 43f2b0c Compare February 26, 2025 18:24
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch from 43f2b0c to c07f95f Compare February 28, 2025 12:40
@khaneliman khaneliman force-pushed the pointer-cursor-modernize branch 3 times, most recently from 66c4ab3 to b817af1 Compare March 8, 2025 00:35
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch 3 times, most recently from 337f7e0 to fa5bdd2 Compare March 10, 2025 10:12
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch from fa5bdd2 to 5f1eee1 Compare March 10, 2025 10:22
@isabelroses isabelroses force-pushed the pointer-cursor-modernize branch from 5f1eee1 to b8b506b Compare March 10, 2025 10:33
Check if a user explicitly set option to null and warn that they should
just disable instead.
@khaneliman khaneliman force-pushed the pointer-cursor-modernize branch from b8b506b to a26ef76 Compare March 12, 2025 13:53
@khaneliman
Copy link
Collaborator

Alright, sorry about delay. Kept forgetting to come back and do the loud deprecation instead of all the state checks. I think this will be easier to transition away from.

Copy link
Collaborator

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

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

Appreciate the work, thanks!

@khaneliman khaneliman merged commit 1878091 into nix-community:master Mar 12, 2025
3 checks passed
@isabelroses isabelroses deleted the pointer-cursor-modernize branch March 12, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants