stylix/testbeds/themes: overhaul testbed themes for broader coverage#1857
Conversation
| icons = { | ||
| dark = "Adwaita"; | ||
| enable = true; | ||
| light = "Adwaita"; | ||
| package = pkgs.adwaita-icon-theme; | ||
| }; |
There was a problem hiding this comment.
Could someone verify whether this works?
| icons = { | ||
| dark = "Adwaita"; | ||
| enable = true; | ||
| package = pkgs.adwaita-icon-theme; | ||
| }; |
There was a problem hiding this comment.
Could someone verify whether this works?
| }; | ||
| }; | ||
|
|
||
| config = lib.mkIf config.stylix.enable ( |
There was a problem hiding this comment.
why are we reverting 73b7d0f? this pretty clear goes against the spirit of 7682713
The new disabled testcase is failing. The following commit fixes that:
stylix/home-manager-integration: unconditionally enable Unconditionally enable the Home Manager integration to avoid error: The option `virtualisation.vmVariant.home-manager.users.guest.stylix' does not exist. Definition values: errors inside 'stylix.enable = false;' testbeds containing the following declaration: home-manager.sharedModules = lib.singleton { stylix.targets.${target}.${option} = value; }; Ideally, the Home Manager integration merely provides the options, and the actual modules should do the guarding.-- fcde0a7 ("stylix/home-manager-integration: unconditionally enable")
When I implemented this fix and quickly glanced over the discussion from commit 73b7d0f, it seems the new test cases cover all problems that were originally mentioned.
I will test each of these cases locally in my standalone Home Manager setup to see if this also works in end-user setups. This is the main reason this PR is currently in draft mode. Also, the commit message from fcde0a7 ("stylix/home-manager-integration: unconditionally enable") is currently just for debugging purposes, and will be overhauled if its diff is good.
There was a problem hiding this comment.
I will test each of these cases locally in my standalone Home Manager setup to see if this also works in end-user setups.
AFAICT, this does not affect Stylix integration with standalone Home Manager. The NixOS and Home Manager integration is covered by the new test cases, while the standalone NixOS integration seems untested.
This is the main reason this PR is currently in draft mode.
I am optimistically marking this PR as ready for review again.
quickly glanced over the discussion from commit 73b7d0f, it seems the new test cases cover all problems that were originally mentioned.
It seems whatever was the issue in that discussion, seems to have resolved itself in the meantime, as indicated by the new theme coverage:
| Theme | image |
base16Scheme |
|---|---|---|
disabled |
false |
false |
default |
false |
true |
partial-light |
true |
false |
full-dark |
true |
true |
There was a problem hiding this comment.
Weighing in here as a random stylix user: in general enable options don't change what you're allowed to write in the config, they only change whether that configuration applies to the resulting system.
Here, guarding the import behind an enable goes against that since it makes the HM options existence conditional on enable, which forces users to hide all their HM config behind stylix.enable. That shouldn't be needed and is bad/unconventional UX. And mkIf is not even enough since the options don't exist, you need optionalAttrs or similar, to completely hide the config values from the module system.
So I also believe reverting 73b7d0f is the right choice, and I arrived to it independently in #2089.
I'd ideally like to see this unblocked and cherry-picked before the rest of the MR cause it's the only custom change I have for Stylix, and I'd rather just use upstream cause it's easier to update compared to rebasing my fork.
There was a problem hiding this comment.
Also I'd recommend adding a comment in the code to explain this, cause it might seem surprising at first compared to other modules.
There was a problem hiding this comment.
in general
enableoptions don't change what you're allowed to write in the config, they only change whether that configuration applies to the resulting system.
If you mean whether options should always be available, this is not generally the case and is AFAIK an undocumented convention: #2078.
I'd ideally like to see this unblocked and cherry-picked before the rest of the MR
As previously mentioned, the final [PATCH 3/3] stylix/testbeds/themes: overhaul testbed themes for broader coverage patch is exactly what increases correctness confidence:
quickly glanced over the discussion from commit 73b7d0f, it seems the new test cases cover all problems that were originally mentioned.
It seems whatever was the issue in that discussion, seems to have resolved itself in the meantime, as indicated by the new theme coverage:
Theme imagebase16Schemedisabledfalsefalsedefaultfalsetruepartial-lighttruefalsefull-darktruetrue
Without it, we merely assume this works. I am in favor of merging this only with the new test coverage.
Also I'd recommend adding a comment in the code to explain this, cause it might seem surprising at first compared to other modules.
I assume you are comparing the /stylix/home-manager-integration.nix core code to /modules/<MODULE>/{hm,nixos}.nix modules. IMHO, the core code should always just work, meaning the previous workaround commit 73b7d0f ("stylix: guard home-manager-integration config (#1494)") was the confusing exception and the new behaviour is the expected one:
Ideally, the Home Manager integration merely provides the options, and the actual modules should do the guarding.-- fcde0a7 ("stylix/home-manager-integration: unconditionally enable")
I think adding such a comment would be actively confusing because it re-states the norm.
There was a problem hiding this comment.
If you mean whether options should always be available, this is not generally the case and is AFAIK an undocumented convention: #2078.
Yes it's an undocumented convention, but it holds true across the entire Nix ecosystem AFAIK.
I think adding such a comment would be actively confusing because it re-states the norm.
It's about communicating with others since this has apparently caused enough confusion with multiple iterations.
I'm happy with whatever you prefer.
Anyways I agree with you in general, I just wanted to give additional input on the original comment, confirming the revert is the right move (IMO ofc) :)
| dark = "Adwaita"; | ||
| enable = true; | ||
| light = "Adwaita"; |
There was a problem hiding this comment.
why are we using the light icons for dark?
| dark = "Adwaita"; | |
| enable = true; | |
| light = "Adwaita"; | |
| dark = "Adwaita Dark"; | |
| enable = true; | |
| light = "Adwaita"; |
There was a problem hiding this comment.
why are we using the light icons for dark?
As implied by the theme name and its file header, full-dark declares all available Stylix options to reasonable non-default values, while partial-light intentionally does not declare all available Stylix options in order to test modularity. The dark and light polarity tests are merged with the "full" and "partial" test cases to reduce the total number of themes. In other words, full-dark declares stylix.icons.light despite being stylix.polarity = "dark"; to test whether this redundant declared value causes any problems.
Suggested change
dark = "Adwaita"; enable = true; light = "Adwaita"; dark = "Adwaita Dark"; enable = true; light = "Adwaita";
Does "Adwaita Dark" work? I see no such reference:
$ nix build --no-link --print-out-paths nixpkgs#adwaita-icon-theme | xargs rg --ignore-case 'Adwaita|Dark|Light'
/nix/store/phcncb0xzj0y2bcx7zd171b32cfqblz2-adwaita-icon-theme-47.0/share/icons/Adwaita/index.theme
2:Name=Adwaita
/nix/store/phcncb0xzj0y2bcx7zd171b32cfqblz2-adwaita-icon-theme-47.0/share/pkgconfig/adwaita-icon-theme.pc
2:Name: adwaita-icon-themeDo not guard on stylix.enable because the original issue from commit 73b7d0f ("stylix: guard home-manager-integration config (nix-community#1494)") seems to have resolved itself in the meantime. This allows testbeds to declare Stylix target options when Stylix is disabled. Reverts: 73b7d0f ("stylix: guard home-manager-integration config (nix-community#1494)")
fcde0a7 to
3c286df
Compare
Submission Checklist
I certify that I have the right to submit this contribution under the MIT license
Commit messages adhere to Stylix commit conventions
Theming changes adhere to the Stylix style guide
Changes have been tested locally
Changes have been tested in testbeds
To test the Kitty module with the new testbed themes, run:
nix build --no-link \ github:trueNAHO/stylix/stylix-testbed-themes-overhaul-testbed-themes-for-broader-coverage#testbed:kitty:{default,disabled,empty,full-dark,partial-light} nix run nixpkgs#parallel -- \ nix run '{}' ::: \ github:trueNAHO/stylix/stylix-testbed-themes-overhaul-testbed-themes-for-broader-coverage#testbed:kitty:{default,disabled,empty,full-dark,partial-light}Each commit in this PR is suitable for backport to the current stable branch
Notify Maintainers
@awwpotato @danth