Skip to content

Commit

Permalink
fix nix-build invocation in non-flake builds
Browse files Browse the repository at this point in the history
The drvpath^out syntax is only part of `nix build', not `nix-build',
which still produces the outPath as it did before, but errors out if
attempted to be called in the same way as `nix build'.
  • Loading branch information
stuebinm committed Jun 11, 2024
1 parent ea0aaeb commit d5f4b0f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,13 @@ pub async fn build_profile(data: PushProfileData<'_>) -> Result<(), PushProfileE
.next()
.ok_or(PushProfileError::ShowDerivationEmpty)?;

// Since nix 2.15.0 'nix build <path>.drv' will build only the .drv file itself, not the
// derivation outputs, '^out' is used to refer to outputs explicitly
let new_deriver = &(deriver.to_owned().to_string() + "^out");
let new_deriver = &if data.supports_flakes {
// Since nix 2.15.0 'nix build <path>.drv' will build only the .drv file itself, not the
// derivation outputs, '^out' is used to refer to outputs explicitly
deriver.to_owned().to_string() + "^out"
} else {
deriver.to_owned()
};

let path_info_output = Command::new("nix")
.arg("--experimental-features").arg("nix-command")
Expand Down

0 comments on commit d5f4b0f

Please sign in to comment.