Skip to content

Commit d5f4b0f

Browse files
committed
fix nix-build invocation in non-flake builds
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'.
1 parent ea0aaeb commit d5f4b0f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/push.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,13 @@ pub async fn build_profile(data: PushProfileData<'_>) -> Result<(), PushProfileE
244244
.next()
245245
.ok_or(PushProfileError::ShowDerivationEmpty)?;
246246

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

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

0 commit comments

Comments
 (0)