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

swaylock: avoid inadvertently installing swaylock #875

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

danth
Copy link
Owner

@danth danth commented Feb 18, 2025

The swaylock Home Manager module automatically enables itself when settings != {} and the state version is earlier than 23.05:

https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17

This corrects the Stylix module to avoid providing settings unless the user already has swaylock enabled, so that swaylock is not installed for all Stylix users.

Fixes #843

@danth danth added the bug Something isn't working properly label Feb 18, 2025
@danth
Copy link
Owner Author

danth commented Feb 18, 2025

Concerned that this may cause an infinite recursion with the aforementioned older state versions, as the default value of enable depends on whether settings is set.

@trueNAHO
Copy link
Collaborator

The swaylock Home Manager module automatically enables itself when settings != {} and the state version is earlier than 23.05:

https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17

This corrects the Stylix module to avoid providing settings unless the user already has swaylock enabled, so that swaylock is not installed for all Stylix users.

Should we support older versions? Otherwise, it might be better to upstream this to Home Manager.

@danth
Copy link
Owner Author

danth commented Feb 18, 2025

Otherwise, it might be better to upstream this to Home Manager.

What do you mean? Presumably the condition exists in Home Manager for backwards compatibility with old configuration which relied on the automatic enable behaviour.

@trueNAHO
Copy link
Collaborator

Concerned that this may cause an infinite recursion with the aforementioned older state versions, as the default value of enable depends on whether settings is set.

@niksingh710, can you test this PR?

@niksingh710
Copy link

@trueNAHO just tested the pr, and now swaylock is not installed.

Avoid inadvertently installing the Swaylock package by preventing the
Home Manager module from enabling itself when 'settings != {}' and the
state version is older than 23.05 [1].

[1]: https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17

Closes: #843
Link: #875

Tested-by: https://github.com/niksingh710
Co-authored-by: NAHO <[email protected]>
Reviewed-by: NAHO <[email protected]>
@trueNAHO trueNAHO force-pushed the swaylock-no-install branch from 7f7c001 to 1ca8dbb Compare February 20, 2025 12:47
@trueNAHO trueNAHO merged commit c424b22 into master Feb 20, 2025
57 checks passed
@trueNAHO trueNAHO deleted the swaylock-no-install branch February 20, 2025 12:48
Mikilio pushed a commit to Mikilio/stylix that referenced this pull request Feb 23, 2025
Avoid inadvertently installing the Swaylock package by preventing the
Home Manager module from enabling itself when 'settings != {}' and the
state version is older than 23.05 [1].

[1]: https://github.com/nix-community/home-manager/blob/5cfbf5cc37a3bd1da07ae84eea1b828909c4456b/modules/programs/swaylock.nix#L12-L17

Closes: danth#843
Link: danth#875

Tested-by: https://github.com/niksingh710
Co-authored-by: NAHO <[email protected]>
Reviewed-by: NAHO <[email protected]>
danth added a commit that referenced this pull request Feb 23, 2025
Although the initial pull request was approved [1], a conversation
on Matrix suggests that infinite recursion is indeed possible in
certain cases [2].

[1]: #875
[2]: https://matrix.to/#/!FBhBUKKFkbUIElLvaF:danth.me/$yZz3nJYu9RgaN3736fxF1xY0BfzceGRSsvpiXSq6go4
danth added a commit that referenced this pull request Feb 24, 2025
Although the initial pull request was approved [1], a conversation
on Matrix suggests that infinite recursion is indeed possible in
certain cases [2].

[1]: #875
[2]: https://matrix.to/#/!FBhBUKKFkbUIElLvaF:danth.me/$yZz3nJYu9RgaN3736fxF1xY0BfzceGRSsvpiXSq6go4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

swaylock: autoEnable causes swaylock to be installed
3 participants