Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,14 @@ pub struct Opts {
}

/// Returns if the available Nix installation supports flakes
async fn test_flake_support() -> Result<bool, std::io::Error> {
async fn test_flake_support(opts: &Opts) -> Result<bool, std::io::Error> {
debug!("Checking for flake support");

Ok(Command::new("nix")
.arg("eval")
.arg("--expr")
.arg("builtins.getFlake")
.args(&opts.extra_build_args)
// This will error on some machines "intentionally", and we don't really need that printing
.stdout(Stdio::null())
.stderr(Stdio::null())
Expand Down Expand Up @@ -697,6 +698,9 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
.collect::<Result<Vec<DeployFlake>, ParseFlakeError>>()?
};

let supports_flakes = test_flake_support(&opts).await.map_err(RunError::FlakeTest)?;
let do_not_want_flakes = opts.file.is_some();

let cmd_overrides = deploy::CmdOverrides {
ssh_user: opts.ssh_user,
profile_user: opts.profile_user,
Expand All @@ -714,9 +718,6 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
interactive_sudo: opts.interactive_sudo
};

let supports_flakes = test_flake_support().await.map_err(RunError::FlakeTest)?;
let do_not_want_flakes = opts.file.is_some();

if !supports_flakes {
warn!("A Nix version without flakes support was detected, support for this is work in progress");
}
Expand Down
9 changes: 5 additions & 4 deletions src/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub async fn build_profile_remotely(data: &PushProfileData<'_>, derivation_name:

// copy the derivation to remote host so it can be built there
let copy_command_status = Command::new("nix")
.arg("--experimental-features").arg("nix-command")
.arg("--extra-experimental-features").arg("nix-command")
.arg("copy")
.arg("-s") // fetch dependencies from substitures, not localhost
.arg("--to").arg(&store_address)
Expand All @@ -187,7 +187,7 @@ pub async fn build_profile_remotely(data: &PushProfileData<'_>, derivation_name:

let mut build_command = Command::new("nix");
build_command
.arg("--experimental-features").arg("nix-command")
.arg("--extra-experimental-features").arg("nix-command")
.arg("build").arg(derivation_name)
.arg("--eval-store").arg("auto")
.arg("--store").arg(&store_address)
Expand Down Expand Up @@ -220,7 +220,7 @@ pub async fn build_profile(data: PushProfileData<'_>) -> Result<(), PushProfileE

// `nix-store --query --deriver` doesn't work on invalid paths, so we parse output of show-derivation :(
let show_derivation_output = Command::new("nix")
.arg("--experimental-features").arg("nix-command")
.arg("--extra-experimental-features").arg("nix-command")
.arg("show-derivation")
.arg(&data.deploy_data.profile.profile_settings.path)
.output()
Expand Down Expand Up @@ -267,7 +267,7 @@ pub async fn build_profile(data: PushProfileData<'_>) -> Result<(), PushProfileE
};

let path_info_output = Command::new("nix")
.arg("--experimental-features").arg("nix-command")
.arg("--extra-experimental-features").arg("nix-command")
.arg("path-info")
.arg(&deriver)
.output().await
Expand Down Expand Up @@ -321,6 +321,7 @@ pub async fn push_profile(data: PushProfileData<'_>) -> Result<(), PushProfileEr
);

let mut copy_command = Command::new("nix");
copy_command.arg("--extra-experimental-features").arg("nix-command");
copy_command.arg("copy");

if data.deploy_data.merged_settings.fast_connection != Some(true) {
Expand Down