From d5f4b0fabb0374cc122b9880315a874fda09f08a Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 7 May 2024 12:56:16 +0200 Subject: [PATCH] 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'. --- src/push.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/push.rs b/src/push.rs index c800a980..864c3369 100644 --- a/src/push.rs +++ b/src/push.rs @@ -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 .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 .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")