Repository navigation
Replies: 2 comments
|
Implemented in #14856: feat(dotfiles): render templates in a variant's target |
0 replies
|
Thank you so much for implementing this in #14856! I've tested it with a build of |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Thank you for all the care you put into mise.
Environment
2026.10.17 macos-arm64 (2026-10-20)The problem
I'd like a shared config to link a directory into the place where an application reads its config, even on machines where that place differs. Here is an example with a hypothetical CLI,
examplectl, which reads$XDG_CONFIG_HOME/examplectl:As far as I can tell, the entry is ignored with this warning, so it looks like the
targetisn't rendered as a template:Writing the target as
~/.config/examplectlworks, but on a machine whereXDG_CONFIG_HOMEpoints somewhere else, the link ends up whereexamplectldoesn't look. The same thing seems to happen when linking a folder into mise's ownconf.don a machine that setsMISE_CONFIG_DIR.What I've tried
~/.config/...works on machines that keep the default location.XDG_CONFIG_HOMEandMISE_CONFIG_DIR, but then the link is no longer part of[dotfiles], somise dot statusandmise bootstrap statusdon't show it.What I've found
A variant's
targetis kept as a plain string:mise/crates/mise-system/src/files.rs
Lines 295 to 300 in 4e92675
and, as far as I can see, the check runs on the string as written, so a template would be rejected before it is rendered:
mise/crates/mise-system/src/files.rs
Lines 357 to 365 in 4e92675
When a variant is selected, its
targetoverrides the table key:mise/crates/mise-system/src/files.rs
Lines 1781 to 1787 in 4e92675
For
[bootstrap.repos], checkout paths are rendered with the template context of the config file that declares them (#14359), and the same helper now covers URLs and refs. It seemed like a pattern that might carry over:mise/crates/mise-system/src/lib.rs
Lines 1037 to 1048 in 4e92675
Idea
Could a variant's
targetbe rendered with the template context of the config file that declares the entry, as[bootstrap.repos]paths are? Since the table key can be a logical name when every variant supplies atarget(Different targets on different machines), rendering only thetargetvalue seems like the most natural fit, while keeping the key stable for overrides between config files.Rendering templates in the table keys themselves could be another option, but it seems likely to touch more places. I'd be glad to hear if that would be a better fit, or if there's a better way to handle config locations that differ between machines.
Thanks for considering this!
AI-assisted — Tool: ChatGPT; model: OpenAI/GPT-6; version: unavailable.
All reactions