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

sway: add preCheckConfig to customize check environment #5315

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

Conversation

amarshall
Copy link
Contributor

Description

See commit messages.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#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

Some situations may require altering the config file itself to remove or
adjust things. While this of course reduces the correctness of the
check, it may be better to lose a little than be forced to disable the
check altogether.
Copy link
Collaborator

@teto teto left a comment

Choose a reason for hiding this comment

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

not worth the complexity IMO. Either users make it work in hte sandbox or they disable the check. One thing we could do if there are too many complaints is to toggle the check off by default

@amarshall
Copy link
Contributor Author

amarshall commented Apr 22, 2024

Where exactly is the complexity? It’s one new option and two lines of code to use it (plus tests).

FWIW, there’s precedence for this sort of thing in NixOS modules (e.g. bird and nftables, which I based this off knowing those exist). Tbh, it doesn’t really matter too much to me as I personally do not need this, and if I did, I would just patch it as I did the actual check for a year.

One argument is that, unlike pkgs, it’s not possible to use overlays for modules, which causes frustration for folks when they want extensibility (so the only way to extend is to patch, which can be cumbersome for some).

@teto
Copy link
Collaborator

teto commented Apr 22, 2024

Where exactly is the complexity? It’s one new option and two lines of code to use it (plus tests).

the diff is 40 lines to modify the check such that it doesn't check the final config, turning it into a potentially useless check. If you dont use it I dont see why we should carry the burden upstream.

One argument is that, unlike pkgs, it’s not possible to use overlays for modules, which causes frustration for folks when they want extensibility (so the only way to extend is to patch, which can be cumbersome for some).

You can perfectly add options under the same namespace via imports. You can see here https://github.com/teto/home/blob/main/hm/modules/zsh.nix how I extend the zsh module for instance.

@amarshall
Copy link
Contributor Author

I added it to try to solve a problem people had in the linked issue. The alternative to “potentially useless” is, as noted in the commit msg, totally useless as it had to be disabled.

That works if the extension is additive, but I don’t see how it works if the “extension” needs to modify an existing thing without completely overwriting it. If you have an example of that, I’d certainly be interested to see it as I repeatedly face such a problem in both HM and NixOS config.

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.

None yet

2 participants