Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
- `nh darwin switch` now shows the output from the `darwin-rebuild` activation.
This allows you to see more details about the activation from `nix-darwin`, as
well as `Home Manager`.
- 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.
Comment on lines +19 to +21
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.


### Fixed

Expand Down
5 changes: 4 additions & 1 deletion src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ where
})?;

if check_res.map(|s| s.trim().to_owned()).as_deref() == Some("true") {
debug!("Using explicit configuration from flag: {}", config_name);
debug!(
"Using explicit configuration from flag/environment: {}",
config_name
);
Comment on lines +246 to +249
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.

attribute.push(config_name);
if push_drv {
attribute.extend(toplevel.clone());
Expand Down
18 changes: 9 additions & 9 deletions src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ pub struct OsRebuildArgs {
pub update_args: UpdateArgs,

/// When using a flake installable, select this hostname from nixosConfigurations
#[arg(long, short = 'H', global = true)]
#[arg(long, short = 'H', global = true, env = "NH_OS_HOSTNAME")]
pub hostname: Option<String>,

/// Explicitly select some specialisation
#[arg(long, short)]
#[arg(long, short, env = "NH_OS_SPECIALISATION")]
pub specialisation: Option<String>,

/// Ignore specialisations
Expand Down Expand Up @@ -236,7 +236,7 @@ pub struct OsRollbackArgs {
pub ask: bool,

/// Explicitly select some specialisation
#[arg(long, short)]
#[arg(long, short, env = "NH_OS_SPECIALISATION")]
pub specialisation: Option<String>,

/// Ignore specialisations
Expand Down Expand Up @@ -280,7 +280,7 @@ pub struct OsReplArgs {
pub installable: Installable,

/// When using a flake installable, select this hostname from nixosConfigurations
#[arg(long, short = 'H', global = true)]
#[arg(long, short = 'H', global = true, env = "NH_OS_HOSTNAME")]
pub hostname: Option<String>,
}

Expand Down Expand Up @@ -443,11 +443,11 @@ pub struct HomeRebuildArgs {
/// Name of the flake homeConfigurations attribute, like username@hostname
///
/// If unspecified, will try <username>@<hostname> and <username>
#[arg(long, short)]
#[arg(long, short, env = "NH_HOME_CONFIGURATION")]
pub configuration: Option<String>,

/// Explicitly select some specialisation
#[arg(long, short)]
#[arg(long, short, env = "NH_HOME_SPECIALISATION")]
pub specialisation: Option<String>,

/// Ignore specialisations
Expand Down Expand Up @@ -483,7 +483,7 @@ pub struct HomeReplArgs {
/// Name of the flake homeConfigurations attribute, like username@hostname
///
/// If unspecified, will try <username>@<hostname> and <username>
#[arg(long, short)]
#[arg(long, short, env = "NH_HOME_CONFIGURATION")]
pub configuration: Option<String>,

/// Extra arguments passed to nix repl
Expand Down Expand Up @@ -556,7 +556,7 @@ pub struct DarwinRebuildArgs {
pub update_args: UpdateArgs,

/// When using a flake installable, select this hostname from darwinConfigurations
#[arg(long, short = 'H', global = true)]
#[arg(long, short = 'H', global = true, env = "NH_DARWIN_HOSTNAME")]
pub hostname: Option<String>,

/// Extra arguments passed to nix build
Expand All @@ -582,7 +582,7 @@ pub struct DarwinReplArgs {
pub installable: Installable,

/// When using a flake installable, select this hostname from darwinConfigurations
#[arg(long, short = 'H', global = true)]
#[arg(long, short = 'H', global = true, env = "NH_DARWIN_HOSTNAME")]
pub hostname: Option<String>,
}

Expand Down