Skip to content

Cannot deploy with Nix 2.32(pre) #340

@Rutherther

Description

@Rutherther

I have installed nix from main branch of nix, nix 2.32-pre, and I couldn't deploy because of a strange error (no such file pointing to cwd/-activatable-nixos-system-...-.drv), I narrowed it down to the fact that nix show-derivation no longer shows full path with newer nix (I am not sure when the change was introduced, reverted back to 2.28 and it's fine)

Instead of something like

> nix show-derivation /nix/store/m1sczr2hq5z1xkg2hzhlpjq0c42isdii-activatable-nixos-system-cerebrum-25.11.20250916.8d4ddb1
{
  "/nix/store/22s18pb08i691lnal0pfm7yyf40pqsdv-activatable-nixos-system-cerebrum-25.11.20250916.8d4ddb1.drv": {

I am getting

> nix derivation show /nix/store/m1sczr2hq5z1xkg2hzhlpjq0c42isdii-activatable-nixos-system-cerebrum-25.11.20250916.8d4ddb1
{
  "22s18pb08i691lnal0pfm7yyf40pqsdv-activatable-nixos-system-cerebrum-25.11.20250916.8d4ddb1.drv": {

This path is obtained in deploy-rs code and then put to nix path-info. 1. it's interpreted as local path, searching under cwd, 2. even if in nix store, there is an error that the path is not a flake.

Here is the problematic code

deploy-rs/src/push.rs

Lines 223 to 261 in 125ae9e

show_derivation_command
.arg("show-derivation")
.arg(&data.deploy_data.profile.profile_settings.path);
let show_derivation_output = show_derivation_command
.output()
.await
.map_err(PushProfileError::ShowDerivation)?;
match show_derivation_output.status.code() {
Some(0) => (),
a => return Err(PushProfileError::ShowDerivationExit(a)),
};
let derivation_info: HashMap<&str, serde_json::value::Value> = serde_json::from_str(
std::str::from_utf8(&show_derivation_output.stdout)
.map_err(PushProfileError::ShowDerivationUtf8)?,
)
.map_err(PushProfileError::ShowDerivationParse)?;
let &deriver = derivation_info
.keys()
.next()
.ok_or(PushProfileError::ShowDerivationEmpty)?;
let new_deriver = &if data.supports_flakes || data.deploy_data.merged_settings.remote_build.unwrap_or(false) {
// 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")
.arg("path-info")
.arg(&deriver)
.output().await
.map_err(PushProfileError::PathInfo)?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions