-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat(modules/nixvim): add color scheme #178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
programs.nixvim
is not available by default so this will cause an error for configs without NixVim imported.
Also, the module file needs to be called hm.nix
, nixos.nix
or darwin.nix
to be loaded properly. It looks like NixVim can be installed on any of those, so we should support them all. If the modules are identical then each file can just import ./nixvim.nix
, or symlinks might work instead.
Co-authored-by: Daniel Thwaites <[email protected]>
Should I add NixVim to the |
That would cause it to be installed for a lot of people who don't want to use it. |
Do you have any other proposals? Conditionally calling Do you have any ideas on how to check if NixVim is available? |
This was something we discussed back when the Hyprland module was not part of Home Manager. In short we came to the decision not to add anything to Stylix which relies on an external module being imported, which NixVim does. If you want to experiment anyway, |
options.stylix.targets.nixvim.enable = | ||
config.lib.stylix.mkEnableTarget "nixvim" true; | ||
|
||
config = lib.mkIf config.stylix.targets.nixvim.enable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to experiment anyway,
options.programs?nixvim
would returntrue
whenprograms.nixvim
exists as an option. (options
can be loaded at the top of the file similar topkgs
andconfig
.)(Source: #178 (comment))
What about the following assertion:
config = lib.mkIf config.stylix.targets.nixvim.enable { | |
config = lib.mkIf config.stylix.targets.nixvim.enable { | |
assertions = [ | |
{ | |
assertion = options.programs?nixvim; | |
message = '' | |
'stylix.targets.nixvim.enable' is set to | |
${config.stylix.targets.nixvim.enable}, but the external | |
'options.programs.nixvim' dependency is unavailable: | |
https://github.com/nix-community/nixvim | |
''; | |
} | |
]; |
Note that I have not actually tested this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With mkIf
, evaluation still fails when the option doesn't exist, even if config.stylix.targets.nixvim.enable
is set to false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should gracefully skip evaluation if config.stylix.targets.nixvim
is not available:
config = lib.mkIf config.stylix.targets.nixvim.enable { | |
config = let | |
targets = config.stylix.targets; | |
in lib.mkIf (targets?nixvim.enable && targets.nixivm.enable) { |
Note that I have not actually tested this.
I will work on this once I have more free time. |
I have fixed the issues with this PR in this fork: https://github.com/willemml/stylix/tree/feat/modules/nixvim I have tested that the build succeeds without installing nixvim. Colors are applied correctly. Assuming these fixes/changes are acceptable should I submit this as a separate PR to the main danth/stylix repo? EDIT: I have added an option for terminal transparency passthrough in a separate branch, I am unsure if this follows stylix module guidelines but here it is: https://github.com/willemml/stylix/tree/feat/modules/nixvim-transparency (willemml@12108f4). |
I have not tested your PR, but the code looks good.
I don't see how more options would be problematic. @danth, what do you think?
Regardless of transparency being accepted, your PR already supersedes mine. Feel free to open a new PR to your https://github.com/willemml/stylix/tree/feat/modules/nixvim-transparency branch, and link it to the original issue and this PR. This makes it easier to close this PR and the original issue later on. |
Superseded by #194. |
About
Closes: #153
Need Help
Currently, this PR does not integrate with NixVim's generated configuration file. This might be related to NixVim not being a Home Manager module.