Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow defining defaults for hermit.hcl in user config #436

Merged

Conversation

lox
Copy link
Contributor

@lox lox commented Feb 18, 2025

Adds support for user-level configuration defaults in Hermit. Users can now define default settings in their ~/.hermit.hcl file that will be applied to all new Hermit environments.

Example ~/.hermit.hcl:

defaults {
  sources = [
    "https://github.com/lox/private-hermit-packages.git", 
    "https://github.com/cashapp/hermit-packages.git"
  ]
}

Also allows the user config file to be defined with HERMIT_USER_CONFIG or --user-config.

This replaces the more narrowly scoped #434.

Adds support for user-level configuration defaults in Hermit. Users can now define
default settings in their ~/.hermit.hcl file that will be applied to all new
Hermit environments.
@lox lox force-pushed the lox/2025-02-18-lox/user-config-defaults branch from 65cd1c3 to 6bfd6f9 Compare February 18, 2025 11:01
@lox
Copy link
Contributor Author

lox commented Feb 18, 2025

Possibly controversial, I removed the resolver for user-config and replaced it with basic overrides in init_cmd.go and activate_cmd.go. They were the only places using it and it seemed not worth the cognitive complexity of the resolver mechanism (and it created a chicken/egg problem where I needed to resolve user-config path before I could create the resolver).

I am sure there is some magic to make this work in the resolver, feel free to tell me what I should do there @alecthomas.

@alecthomas
Copy link
Collaborator

Glorious! Thanks @lox !

@alecthomas alecthomas merged commit 55c98fd into cashapp:master Feb 21, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants