Last active
November 9, 2024 20:50
-
-
Save sodiboo/29c4803f189cd81f298702559f24b7ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this is a home-manager module | |
| {lib, options, ...}: let | |
| settings-binds-type = let | |
| traverse = v: | |
| if (v ? _type && v._type == "option") | |
| then | |
| { | |
| ${lib.concatStringsSep "." v.loc} = v; | |
| } | |
| // traverse (v.type.getSubOptions v.loc) | |
| else lib.concatMapAttrs (lib.const traverse) (lib.filterAttrs (name: lib.const (name != "_module")) v); | |
| in | |
| # based on global attr path if you run home manager as a nixos module | |
| # (traverse options.programs.niri.settings)."home-manager.users.sodiboo.programs.niri.settings.binds".type; | |
| # manually specify the base path | |
| # (traverse (options.programs.niri.settings.type.getSubOptions ["settings"]))."settings.binds".type; | |
| # shortest | |
| (traverse (options.programs.niri.settings.type.getSubOptions []))."binds".type; | |
| in { | |
| # ... configuration making use of above type | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment