Skip to content

Conversation

@Aehmlo
Copy link

@Aehmlo Aehmlo commented Jul 8, 2025

This PR uses clap's env attribute to specify fallback sources for specifying home configurations, NixOS/Darwin hostnames, and home/NixOS specialisations for situations where the default heuristics are insufficient.

Closes #348.

Aehmlo added 2 commits July 8, 2025 16:41
This revision introduces a handful of environmental variables to enable
fallbacks similar to the NH_FLAKE environmental variable family:

* NH_OS_HOSTNAME,
* NH_OS_SPECIALISATION,
* NH_HOME_CONFIGURATION,
* NH_HOME_SPECIALISATION, and
* NH_DARWIN_HOSTNAME.
Since there's no way to distinguish between "the user provided a home
configuration with --configuration" from "the user provided a home
configuration using NH_HOME_CONFIGURATION," this revision updates debug
log wording appropriately.
Copy link
Member

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little unsure if this is the most elegant solution here, but the change is small enough that I'll let it go. If you could address my comments, I can merge this.

Comment on lines +246 to +249
debug!(
"Using explicit configuration from flag/environment: {}",
config_name
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
debug!(
"Using explicit configuration from flag/environment: {}",
config_name
);
debug!(
"Using explicit configuration from flag/environment: {config_name}",
);

If I'm not mistaken clippy will tell you this is the correct way. Could also be applied with sh fix.sh in the repository root.

Comment on lines +19 to +21
- The `NH_OS_HOSTNAME`, `NH_OS_SPECIALISATION`, `NH_HOME_CONFIGURATION`,
`NH_HOME_SPECIALISATION`, and `NH_DARWIN_HOSTNAME` environmental variables are
now consulted when determining what attribute/specialisation to use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to be a bit more explicit than "now consulted". Please try to specify the priority and the motive of this change for the potential readers.

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.

Default hostname/configuration and specialisation customization

3 participants