stylix: restrict access to config while using mkTarget#1368
stylix: restrict access to config while using mkTarget#1368trueNAHO merged 2 commits intonix-community:masterfrom
Conversation
587d0ad to
a1e5024
Compare
trueNAHO
left a comment
There was a problem hiding this comment.
allows for accessing config once
confighas been removed from module args (if that ends up happening). Also allows for removal of the review burden of ensuringconfig.stylixorconfig.stylix.lib.colorsisn't accessed when usingconfig.
IIUC, this is for the following additional safety:
-{ config, mkTarget, ... }:
+{ mkTarget, ... }:
mkTarget {
name = /* ... */;
humanName = /* ... */;
- configElements = ({ colors }: { /* ... */ });
+ configElements = ({ config, colors }: { /* ... */ });
}
MattSturgeon
left a comment
There was a problem hiding this comment.
IMO this feels like something that should be done in the file's top-level args (which are currently the module args), rather than configElement args.
Only being able to access config from within a configElement feels cumbersome; you may wish to also access it in option defaults, in shared/common let binding, etc.
But I don't see any issue with the implementation, if you want to stick with this approach for now.
Agreed. Though I can somewhat see the draw of wanting to eliminate the top-level args, I think that the visual improvement is very little in comparison to the increased difficulty for new contributors. Its abstractions are great for the future and people who understand it well, but the more |
there are 3 options here
|
What do you mean by this? |
I don't think that's necessarily true. With some refactoring, This would work the same way as (e.g.) nixpkgs With the current design, usage would be a bit ugly, but this would improve once modules are no longer modules and are instead implicitly "args for mkTarget". { mkTarget, ... }:
mkTarget (
{ config, options, pkgs ... }:
{
name = "foo";
humanName = "bar";
}
) |
a1e5024 to
afb9b35
Compare
afb9b35 to
df59edf
Compare
MattSturgeon
left a comment
There was a problem hiding this comment.
LGTM, but the commit/title should change to reflect that this isn't adding the ability to access config. Rather it is adding restrictions to the config that was already accessible.
Something like stylix: restrict access to config in mkTarget?
df59edf to
c1569fa
Compare
70084f8 to
6d976e3
Compare
91fca8f to
3af67f7
Compare
3af67f7 to
50170c7
Compare
trueNAHO
left a comment
There was a problem hiding this comment.
Code LGTM. Could you rebase to resolve the merge conflicts and double check that no config module accesses have been missed elsewhere in the tree?
|
either need to manual merge or have @danth approve for the auto merge to work |
|
Successfully created backport PR for |
Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)")
…#1368) Link: nix-community#1368 Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Reviewed-by: Matt Sturgeon <matt@sturgeon.me.uk> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)") Fixes: 713f8da ("rofi: use mkTarget (nix-community#1550)")
Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)") Link: nix-community#1613 Reviewed-by: awwpotato <awwpotato@voidq.com>
Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)")
Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)")
Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)")
Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)") (cherry picked from commit 1272e68)
Rename the mkConfig function to callModule to generalize the name beyond the specific config and options module arguments. Fixes: dea0337 ("stylix: restrict access to config while using mkTarget (nix-community#1368)")
allows for accessing config once
confighas been removed from module args (if that ends up happening). Also allows for removal of the review burden of ensuringconfig.stylixorconfig.stylix.lib.colorsisn't accessed when usingconfig.cc @trueNAHO @MattSturgeon @Flameopathic
Things done
Notify maintainers