diff options
author | stuebinm | 2024-05-07 12:56:16 +0200 |
---|---|---|
committer | stuebinm | 2024-06-11 20:00:09 +0200 |
commit | d5f4b0fabb0374cc122b9880315a874fda09f08a (patch) | |
tree | 4041e1ac76c702b338c781c2ec25eda29c6f54e3 | |
parent | ea0aaeb222ed07722b05ef2d8fbb840df4f77c49 (diff) |
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'.
-rw-r--r-- | src/push.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/push.rs b/src/push.rs index c800a98..864c336 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 <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") |