{i3,sway}: export bar configuration through options#1502
{i3,sway}: export bar configuration through options#1502trueNAHO merged 2 commits intonix-community:masterfrom
Conversation
447f3b0 to
678da55
Compare
There was a problem hiding this comment.
Would it be desirable to generally expose every target's configuration? In that case, mkTarget would generate the option with a consistent description. Unsure whether the configuration should be declared in the option as:
options.stylix.targets.${name}.config = lib.mkOption {
default = /* configuration */;
readOnly = true;
};
config = config.stylix.targets.${name}.config;or in the configuration as:
options.stylix.targets.${name}.config = lib.mkOption {
readOnly = true;
};
config.stylix.targets.${name}.config = /* configuration */;On a side note, once the mkTarget migration is complete, we could trivially allow end-users to extend mkTarget's configElements:
options.stylix.targets.${name}.extraConfig = lib.mkOption {
type = /* mkTarget's configElements */;
description = /* Provide a link to mkTarget's source code documentation */;
default = [];
};
config = lib.mkIf (config.stylix.enable && cfg.enable) (
lib.mkMerge (
lib.optional (generalConfig != null) (mkConfig generalConfig)
++ map mkConditionalConfig (
(lib.toList configElements) ++ (lib.toList cfg.extraConfig)
)
)
);This would allow grouping styling-related declarations under the stylix namespace:
stylix = {
enable = true;
targets."<TARGET>".extraConfig =
{ colors }:
{ programs."<TARGET>".settings.background = lib.mkForce colors.base01; };
};
I don't think so; I can't think of a use case. These specific examples are solutions to somewhat uncommon problems, and they require a specific subset of the target's |
mightyiam
left a comment
There was a problem hiding this comment.
This exportedFoo, is there precedence for this in the ecosystem? I'm not opposed to it. Seems alright to me.
There's nothing fundamentally different - I think it's just that these modules are very old and haven't had a lot of attention since. It should be possible to make these modules work the way Firefox and VSCode do, or the other way around, to settle on a standard.
In most cases this is already available by reading the options we set, unless the user has overridden it. But in that case they would probably be interested in reading their overridden version anyway. |
678da55 to
5711904
Compare
No, this would be setting a precedent.
Alright. In that case, I think that this NixVim option is still necessary because its use is slightly different than the others, but all of the other targets should be set up like VSCode and Firefox. To do that, though, it would probably be worth having some sort of abstraction for setting up warnings and/or options. |
|
the naming of this pr/commit/options doesn't make much sense, config already means something in the nix module system. Renaming the options to some else would be best, e.g. |
The NixVim commit 0a4755b656c28043c52063384fc68bbb30913903
Author: Matt Sturgeon <matt@sturgeon.me.uk>
Date: 2024-06-05 03:10:32 +0100
nixvim: expose config as read-only option
Allow standalone nixvim users to take advantage of stylix by exposing
the generated config as `config.lib.stylix.nixvim.config`.
This can be passed to the nixvim derivation's `extend` function or used
directly in a nixvim configuration.The other modules touched in this PR expose sensible theming declarations to allow end-users to build upon them to write their own configuration. This pattern is inconsistent with declaring a sensible default configuration without any real customizing capabilities (aside from simply overriding it with Should these declaration expositions and default configurations be handled differently or not? The |
I was under the impression that this is not the primary goal of exporting the configuration and that the actual goal is to give the user a relatively simple way of applying theming to attributes with user-set paths (ex.
Agreed. Do you mean
I believe that this is another good reason to make these targets function like Firefox and VSCode, which would mean they would behave more like regular targets. |
👍 Simply overriding with Targets that can behave like Firefox probably should. All they need to know is some attribute name to apply to. It's the list case that can't quite work that way and forces us to provide a value for the user to wire up themselves. |
Either way, extending the Stylix configuration seems to be the end result.
Yes, I meant
What exactly do you mean by making the targets from this PR like Firefox and VSCode? Do you mean providing
|
Firefox and VSCode use |
6681108 to
2a8e5e6
Compare
I completely missed this detail. I hadn't realized the difference between I have adjusted the scope of this PR to exclude i3status-rust (as its bar configurations are named and can be treated like Firefox) and nixvim (as I have already made the necessary change in #1535). |
|
I notice that this is marked as ready for review but just making sure by asking. Would it help if I tested this against my presonal usage at this point? |
|
This is ready for review, but it no longer includes NixVim. If you use i3 or sway bars, though, it would help if you tested this. |
|
Ah, no, I don't use them, sorry. Thanks. Keep up the good work. |
2a8e5e6 to
e7ce05c
Compare
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Link: #1502 Reviewed-by: Daniel Thwaites <danth@danth.me> Reviewed-by: Shahar "Dawn" Or <mightyiampresence@gmail.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> (cherry picked from commit a0e891b)
|
Successfully created backport PR for |
Link: #1502 Reviewed-by: Daniel Thwaites <danth@danth.me> Reviewed-by: Shahar "Dawn" Or <mightyiampresence@gmail.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> (cherry picked from commit a0e891b)
Fixes: a0e891b ("{i3,sway}: export bar configuration through options (nix-community#1502)")
Link: nix-community#1502 Reviewed-by: Daniel Thwaites <danth@danth.me> Reviewed-by: Shahar "Dawn" Or <mightyiampresence@gmail.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Related: #1469
Possibly related: #415
Things done
Notify maintainers
@mightyiam @butzist @trueNAHO