From c97ddd309dc8d41c5949c8e6381cafdc9d1ba9fa Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:31:12 -0500 Subject: [PATCH 01/12] Support remote-building to macOS hosts Our README has long featured a snippet to add to the zshenv, with a caevat that it might behave strangely if you're writing a script with an empty PATH. It is pretty straightforward to eliminate those caveats while still providing remote building for Nix to macOS hosts. --- README.md | 18 +- src/action/macos/configure_remote_building.rs | 166 ++++++++++++++++++ src/action/macos/mod.rs | 2 + src/cli/subcommand/repair.rs | 19 +- src/planner/macos.rs | 10 +- 5 files changed, 196 insertions(+), 19 deletions(-) create mode 100644 src/action/macos/configure_remote_building.rs diff --git a/README.md b/README.md index f72f64b40..abf2875e1 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,8 @@ While `nix-installer` tries to provide a comprehensive and unquirky experience, ### Using MacOS remote SSH builders, Nix binaries are not on `$PATH` +*For Nix installations before Determinate Nix Installer version 0.14.1.* + When connecting to a Mac remote SSH builder users may sometimes see this error: ```bash @@ -288,25 +290,11 @@ There are two possible workarounds for this: * Update `/etc/zshenv` on the remote so that `zsh` populates the Nix path for every shell, even those that are neither *interactive* or *login*: ```bash # Nix - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then + if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n "${SSH_CONNECTION}" ] && [ "${SHLVL}" -eq 1 ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi # End Nix ``` -
- This strategy has some behavioral caveats, namely, $PATH may have unexpected contents - - For example, if `$PATH` gets unset then a script invoked, `$PATH` may not be as empty as expected: - ```bash - $ cat example.sh - #! /bin/zsh - echo $PATH - $ PATH= ./example.sh - /Users/ephemeraladmin/.nix-profile/bin:/nix/var/nix/profiles/default/bin: - ``` - This strategy results in Nix's paths being present on `$PATH` twice and may have a minor impact on performance. - -
### Using MacOS after removing `nix` while `nix-darwin` was still installed, network requests fail diff --git a/src/action/macos/configure_remote_building.rs b/src/action/macos/configure_remote_building.rs new file mode 100644 index 000000000..5634bb3ac --- /dev/null +++ b/src/action/macos/configure_remote_building.rs @@ -0,0 +1,166 @@ +use crate::action::base::{create_or_insert_into_file, CreateOrInsertIntoFile}; +use crate::action::{ + Action, ActionDescription, ActionError, ActionErrorKind, ActionTag, StatefulAction, +}; + +use std::path::Path; +use tokio::task::JoinSet; +use tracing::{span, Instrument, Span}; + +const PROFILE_NIX_FILE_SHELL: &str = "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"; + +/** +Configure macOS's zshenv to load the Nix environment when ForceCommand is used. +This enables remote building, which requires `ssh host nix` to work. + */ +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] +pub struct ConfigureRemoteBuilding { + create_or_insert_into_files: Vec>, +} + +impl ConfigureRemoteBuilding { + #[tracing::instrument(level = "debug", skip_all)] + pub async fn plan() -> Result, ActionError> { + let mut create_or_insert_into_files = Vec::default(); + + let shell_buf = format!( + r#" +# Nix, only on remote SSH connections -- for remote building. +# See: +if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION}}" ] && [ "${{SHLVL}}" -eq 1 ]; then + . '{PROFILE_NIX_FILE_SHELL}' +fi +# End Nix +"# + ); + + let profile_target_path = Path::new("/etc/zshenv"); + create_or_insert_into_files.push( + CreateOrInsertIntoFile::plan( + profile_target_path, + None, + None, + 0o644, + shell_buf.to_string(), + create_or_insert_into_file::Position::Beginning, + ) + .await + .map_err(Self::error)?, + ); + + Ok(Self { + create_or_insert_into_files, + } + .into()) + } +} + +#[async_trait::async_trait] +#[typetag::serde(name = "configure_remote_building")] +impl Action for ConfigureRemoteBuilding { + fn action_tag() -> ActionTag { + ActionTag("configure_remote_building") + } + fn tracing_synopsis(&self) -> String { + "Configuring zsh to support using Nix in non-interactive shells".to_string() + } + + fn tracing_span(&self) -> Span { + span!(tracing::Level::DEBUG, "configure_remote_building",) + } + + fn execute_description(&self) -> Vec { + vec![ActionDescription::new( + self.tracing_synopsis(), + vec!["Update zshenv to import Nix".to_string()], + )] + } + + #[tracing::instrument(level = "debug", skip_all)] + async fn execute(&mut self) -> Result<(), ActionError> { + let mut set = JoinSet::new(); + let mut errors = vec![]; + + for (idx, create_or_insert_into_file) in + self.create_or_insert_into_files.iter_mut().enumerate() + { + let span = tracing::Span::current().clone(); + let mut create_or_insert_into_file_clone = create_or_insert_into_file.clone(); + let _abort_handle = set.spawn(async move { + create_or_insert_into_file_clone + .try_execute() + .instrument(span) + .await + .map_err(Self::error)?; + Result::<_, ActionError>::Ok((idx, create_or_insert_into_file_clone)) + }); + } + + while let Some(result) = set.join_next().await { + match result { + Ok(Ok((idx, create_or_insert_into_file))) => { + self.create_or_insert_into_files[idx] = create_or_insert_into_file + }, + Ok(Err(e)) => errors.push(e), + Err(e) => return Err(Self::error(e))?, + }; + } + + if !errors.is_empty() { + if errors.len() == 1 { + return Err(Self::error(errors.into_iter().next().unwrap()))?; + } else { + return Err(Self::error(ActionErrorKind::MultipleChildren( + errors.into_iter().collect(), + ))); + } + } + + Ok(()) + } + + fn revert_description(&self) -> Vec { + vec![ActionDescription::new( + "Remove the Nix configuration from zsh's non-login shells".to_string(), + vec!["Update zshenv to no longer import Nix".to_string()], + )] + } + + #[tracing::instrument(level = "debug", skip_all)] + async fn revert(&mut self) -> Result<(), ActionError> { + let mut set = JoinSet::new(); + let mut errors = vec![]; + + for (idx, create_or_insert_into_file) in + self.create_or_insert_into_files.iter_mut().enumerate() + { + let mut create_or_insert_file_clone = create_or_insert_into_file.clone(); + let _abort_handle = set.spawn(async move { + create_or_insert_file_clone.try_revert().await?; + Result::<_, _>::Ok((idx, create_or_insert_file_clone)) + }); + } + + while let Some(result) = set.join_next().await { + match result { + Ok(Ok((idx, create_or_insert_into_file))) => { + self.create_or_insert_into_files[idx] = create_or_insert_into_file + }, + Ok(Err(e)) => errors.push(e), + // This is quite rare and generally a very bad sign. + Err(e) => return Err(e).map_err(|e| Self::error(ActionErrorKind::from(e)))?, + }; + } + + if errors.is_empty() { + Ok(()) + } else if errors.len() == 1 { + Err(errors + .into_iter() + .next() + .expect("Expected 1 len Vec to have at least 1 item")) + } else { + Err(Self::error(ActionErrorKind::MultipleChildren(errors))) + } + } +} diff --git a/src/action/macos/mod.rs b/src/action/macos/mod.rs index 4299d7fc0..7ad01fb90 100644 --- a/src/action/macos/mod.rs +++ b/src/action/macos/mod.rs @@ -2,6 +2,7 @@ */ pub(crate) mod bootstrap_launchctl_service; +pub(crate) mod configure_remote_building; pub(crate) mod create_apfs_volume; pub(crate) mod create_fstab_entry; pub(crate) mod create_nix_hook_service; @@ -16,6 +17,7 @@ pub(crate) mod set_tmutil_exclusions; pub(crate) mod unmount_apfs_volume; pub use bootstrap_launchctl_service::BootstrapLaunchctlService; +pub use configure_remote_building::ConfigureRemoteBuilding; pub use create_apfs_volume::CreateApfsVolume; pub use create_nix_hook_service::CreateNixHookService; pub use create_nix_volume::{CreateNixVolume, NIX_VOLUME_MOUNTD_DEST}; diff --git a/src/cli/subcommand/repair.rs b/src/cli/subcommand/repair.rs index 3b4fb1e3f..a027bc3c1 100644 --- a/src/cli/subcommand/repair.rs +++ b/src/cli/subcommand/repair.rs @@ -38,9 +38,22 @@ impl CommandExecute for Repair { if let Err(err) = reconfigure.try_execute().await { println!("{:#?}", err); - Ok(ExitCode::FAILURE) - } else { - Ok(ExitCode::SUCCESS) + return Ok(ExitCode::FAILURE) } + + #[cfg(target_os = "macos")] + { + let mut reconfigure = crate::action::macos::ConfigureRemoteBuilding::plan() + .await + .map_err(PlannerError::Action)? + .boxed(); + + if let Err(err) = reconfigure.try_execute().await { + println!("{:#?}", err); + return Ok(ExitCode::FAILURE) + } + } + + Ok(ExitCode::SUCCESS) } } diff --git a/src/planner/macos.rs b/src/planner/macos.rs index 28398d5cd..a35a91a5f 100644 --- a/src/planner/macos.rs +++ b/src/planner/macos.rs @@ -12,7 +12,9 @@ use crate::{ action::{ base::RemoveDirectory, common::{ConfigureInitService, ConfigureNix, CreateUsersAndGroups, ProvisionNix}, - macos::{CreateNixHookService, CreateNixVolume, SetTmutilExclusions}, + macos::{ + ConfigureRemoteBuilding, CreateNixHookService, CreateNixVolume, SetTmutilExclusions, + }, StatefulAction, }, execute_command, @@ -166,6 +168,12 @@ impl Planner for Macos { .map_err(PlannerError::Action)? .boxed(), ); + plan.push( + ConfigureRemoteBuilding::plan() + .await + .map_err(PlannerError::Action)? + .boxed(), + ); if self.settings.modify_profile { plan.push( From 951842c1938640e7a8b8cce5d68e982c55dfd37f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:32:27 -0500 Subject: [PATCH 02/12] Update the ticket number --- src/action/macos/configure_remote_building.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action/macos/configure_remote_building.rs b/src/action/macos/configure_remote_building.rs index 5634bb3ac..3e1fca016 100644 --- a/src/action/macos/configure_remote_building.rs +++ b/src/action/macos/configure_remote_building.rs @@ -26,7 +26,7 @@ impl ConfigureRemoteBuilding { let shell_buf = format!( r#" # Nix, only on remote SSH connections -- for remote building. -# See: +# See: https://github.com/DeterminateSystems/nix-installer/pull/714 if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION}}" ] && [ "${{SHLVL}}" -eq 1 ]; then . '{PROFILE_NIX_FILE_SHELL}' fi From 821db68d60c9b898f01b48f269326cdc2d56eefa Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:40:54 -0500 Subject: [PATCH 03/12] fixup --- src/cli/subcommand/repair.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/subcommand/repair.rs b/src/cli/subcommand/repair.rs index a027bc3c1..ac2b4a994 100644 --- a/src/cli/subcommand/repair.rs +++ b/src/cli/subcommand/repair.rs @@ -38,7 +38,7 @@ impl CommandExecute for Repair { if let Err(err) = reconfigure.try_execute().await { println!("{:#?}", err); - return Ok(ExitCode::FAILURE) + return Ok(ExitCode::FAILURE); } #[cfg(target_os = "macos")] @@ -50,7 +50,7 @@ impl CommandExecute for Repair { if let Err(err) = reconfigure.try_execute().await { println!("{:#?}", err); - return Ok(ExitCode::FAILURE) + return Ok(ExitCode::FAILURE); } } From de176f8f4403511f8d297f2fb77d12c7596218e4 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:50:44 -0500 Subject: [PATCH 04/12] Remove the whole section about nix not being in the path --- README.md | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/README.md b/README.md index abf2875e1..0e1583b24 100644 --- a/README.md +++ b/README.md @@ -265,37 +265,6 @@ This is especially useful when using the installer in non-interactive scripts. While `nix-installer` tries to provide a comprehensive and unquirky experience, there are unfortunately some issues which may require manual intervention or operator choices. -### Using MacOS remote SSH builders, Nix binaries are not on `$PATH` - -*For Nix installations before Determinate Nix Installer version 0.14.1.* - -When connecting to a Mac remote SSH builder users may sometimes see this error: - -```bash -$ nix store ping --store "ssh://$USER@$HOST" -Store URL: ssh://$USER@$HOST -zsh:1: command not found: nix-store -error: cannot connect to '$USER@$HOST' -``` - -The way MacOS populates the `PATH` environment differs from other environments. ([Some background](https://gist.github.com/Linerre/f11ad4a6a934dcf01ee8415c9457e7b2)) - -There are two possible workarounds for this: - -* **(Preferred)** Update the remote builder URL to include the `remote-program` parameter pointing to `nix-store`. For example: - ```bash - nix store ping --store "ssh://$USER@$HOST?remote-program=/nix/var/nix/profiles/default/bin/nix-store" - ``` - If you are unsure where the `nix-store` binary is located, run `which nix-store` on the remote. -* Update `/etc/zshenv` on the remote so that `zsh` populates the Nix path for every shell, even those that are neither *interactive* or *login*: - ```bash - # Nix - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n "${SSH_CONNECTION}" ] && [ "${SHLVL}" -eq 1 ]; then - . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' - fi - # End Nix - ``` - ### Using MacOS after removing `nix` while `nix-darwin` was still installed, network requests fail If `nix` was previously uninstalled without uninstalling `nix-darwin` first, users may experience errors similar to this: From 00c5d575e169e4ad7b50be3e3c61ce76f3a8b91c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:51:28 -0500 Subject: [PATCH 05/12] Add a couple perks --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0e1583b24..a461dca97 100644 --- a/README.md +++ b/README.md @@ -426,6 +426,7 @@ Subtle differences in the shell implementations and tool used in the scripts mak The Determinate Nix installer has numerous advantages: +* survives macOS upgrades * keeping an installation receipt for easy uninstallation * offering users a chance to review an accurate, calculated install plan * having 'planners' which can create appropriate install plans for complicated targets @@ -434,6 +435,7 @@ The Determinate Nix installer has numerous advantages: * supporting a expanded test suite including 'curing' cases * supporting SELinux and OSTree based distributions without asking users to make compromises * operating as a single, static binary with external dependencies such as `openssl`, only calling existing system tools (like `useradd`) where necessary +* supports remote building out of the box It has been wonderful to collaborate with other participants in the Nix Installer Working Group and members of the broader community. The working group maintains a [foundation owned fork of the installer](https://github.com/nixos/experimental-nix-installer/). From 618fefaa530d2b7f308ed1009f7e579e79d8cb81 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:51:47 -0500 Subject: [PATCH 06/12] A million :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a461dca97..fb78c8ff5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A fast, friendly, and reliable tool to help you use Nix with Flakes everywhere. curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install ``` -The `nix-installer` has successfully completed over 500,000 installs in a number of environments, including [Github Actions](#as-a-github-action): +The `nix-installer` has successfully completed over 1,000,000 installs in a number of environments, including [Github Actions](#as-a-github-action): | Platform | Multi User | `root` only | Maturity | |------------------------------|:------------------:|:-----------:|:-----------------:| From 5cd0ceff4c4bddace9ceec363b351ab1b1da0e74 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:52:27 -0500 Subject: [PATCH 07/12] quote the zshenv path in the plan --- src/action/macos/configure_remote_building.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/action/macos/configure_remote_building.rs b/src/action/macos/configure_remote_building.rs index 3e1fca016..4c9d856f0 100644 --- a/src/action/macos/configure_remote_building.rs +++ b/src/action/macos/configure_remote_building.rs @@ -72,7 +72,7 @@ impl Action for ConfigureRemoteBuilding { fn execute_description(&self) -> Vec { vec![ActionDescription::new( self.tracing_synopsis(), - vec!["Update zshenv to import Nix".to_string()], + vec!["Update `/etc/zshenv` to import Nix".to_string()], )] } @@ -122,7 +122,7 @@ impl Action for ConfigureRemoteBuilding { fn revert_description(&self) -> Vec { vec![ActionDescription::new( "Remove the Nix configuration from zsh's non-login shells".to_string(), - vec!["Update zshenv to no longer import Nix".to_string()], + vec!["Update `/etc/zshenv` to no longer import Nix".to_string()], )] } From ae21843638eae686746a6b16b439e095dfa1eea0 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 10:54:52 -0500 Subject: [PATCH 08/12] Zshenv comment nit --- src/action/macos/configure_remote_building.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/action/macos/configure_remote_building.rs b/src/action/macos/configure_remote_building.rs index 4c9d856f0..63dd59136 100644 --- a/src/action/macos/configure_remote_building.rs +++ b/src/action/macos/configure_remote_building.rs @@ -25,7 +25,7 @@ impl ConfigureRemoteBuilding { let shell_buf = format!( r#" -# Nix, only on remote SSH connections -- for remote building. +# Set up Nix only on SSH connections # See: https://github.com/DeterminateSystems/nix-installer/pull/714 if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION}}" ] && [ "${{SHLVL}}" -eq 1 ]; then . '{PROFILE_NIX_FILE_SHELL}' From 389f502f92bc619cfdd2396bfb9bf44d206657ba Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 11:31:19 -0500 Subject: [PATCH 09/12] one action is a lot less work lol --- src/action/macos/configure_remote_building.rs | 112 ++++-------------- 1 file changed, 21 insertions(+), 91 deletions(-) diff --git a/src/action/macos/configure_remote_building.rs b/src/action/macos/configure_remote_building.rs index 63dd59136..3d9e03690 100644 --- a/src/action/macos/configure_remote_building.rs +++ b/src/action/macos/configure_remote_building.rs @@ -1,10 +1,7 @@ use crate::action::base::{create_or_insert_into_file, CreateOrInsertIntoFile}; -use crate::action::{ - Action, ActionDescription, ActionError, ActionErrorKind, ActionTag, StatefulAction, -}; +use crate::action::{Action, ActionDescription, ActionError, ActionTag, StatefulAction}; use std::path::Path; -use tokio::task::JoinSet; use tracing::{span, Instrument, Span}; const PROFILE_NIX_FILE_SHELL: &str = "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"; @@ -15,14 +12,12 @@ This enables remote building, which requires `ssh host nix` to work. */ #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct ConfigureRemoteBuilding { - create_or_insert_into_files: Vec>, + create_or_insert_into_file: StatefulAction, } impl ConfigureRemoteBuilding { #[tracing::instrument(level = "debug", skip_all)] pub async fn plan() -> Result, ActionError> { - let mut create_or_insert_into_files = Vec::default(); - let shell_buf = format!( r#" # Set up Nix only on SSH connections @@ -34,22 +29,19 @@ fi "# ); - let profile_target_path = Path::new("/etc/zshenv"); - create_or_insert_into_files.push( - CreateOrInsertIntoFile::plan( - profile_target_path, - None, - None, - 0o644, - shell_buf.to_string(), - create_or_insert_into_file::Position::Beginning, - ) - .await - .map_err(Self::error)?, - ); + let create_or_insert_into_file = CreateOrInsertIntoFile::plan( + Path::new("/etc/zshenv"), + None, + None, + 0o644, + shell_buf.to_string(), + create_or_insert_into_file::Position::Beginning, + ) + .await + .map_err(Self::error)?; Ok(Self { - create_or_insert_into_files, + create_or_insert_into_file, } .into()) } @@ -78,43 +70,12 @@ impl Action for ConfigureRemoteBuilding { #[tracing::instrument(level = "debug", skip_all)] async fn execute(&mut self) -> Result<(), ActionError> { - let mut set = JoinSet::new(); - let mut errors = vec![]; - - for (idx, create_or_insert_into_file) in - self.create_or_insert_into_files.iter_mut().enumerate() - { - let span = tracing::Span::current().clone(); - let mut create_or_insert_into_file_clone = create_or_insert_into_file.clone(); - let _abort_handle = set.spawn(async move { - create_or_insert_into_file_clone - .try_execute() - .instrument(span) - .await - .map_err(Self::error)?; - Result::<_, ActionError>::Ok((idx, create_or_insert_into_file_clone)) - }); - } - - while let Some(result) = set.join_next().await { - match result { - Ok(Ok((idx, create_or_insert_into_file))) => { - self.create_or_insert_into_files[idx] = create_or_insert_into_file - }, - Ok(Err(e)) => errors.push(e), - Err(e) => return Err(Self::error(e))?, - }; - } - - if !errors.is_empty() { - if errors.len() == 1 { - return Err(Self::error(errors.into_iter().next().unwrap()))?; - } else { - return Err(Self::error(ActionErrorKind::MultipleChildren( - errors.into_iter().collect(), - ))); - } - } + let span = tracing::Span::current().clone(); + self.create_or_insert_into_file + .try_execute() + .instrument(span) + .await + .map_err(Self::error)?; Ok(()) } @@ -128,39 +89,8 @@ impl Action for ConfigureRemoteBuilding { #[tracing::instrument(level = "debug", skip_all)] async fn revert(&mut self) -> Result<(), ActionError> { - let mut set = JoinSet::new(); - let mut errors = vec![]; - - for (idx, create_or_insert_into_file) in - self.create_or_insert_into_files.iter_mut().enumerate() - { - let mut create_or_insert_file_clone = create_or_insert_into_file.clone(); - let _abort_handle = set.spawn(async move { - create_or_insert_file_clone.try_revert().await?; - Result::<_, _>::Ok((idx, create_or_insert_file_clone)) - }); - } + self.create_or_insert_into_file.try_revert().await?; - while let Some(result) = set.join_next().await { - match result { - Ok(Ok((idx, create_or_insert_into_file))) => { - self.create_or_insert_into_files[idx] = create_or_insert_into_file - }, - Ok(Err(e)) => errors.push(e), - // This is quite rare and generally a very bad sign. - Err(e) => return Err(e).map_err(|e| Self::error(ActionErrorKind::from(e)))?, - }; - } - - if errors.is_empty() { - Ok(()) - } else if errors.len() == 1 { - Err(errors - .into_iter() - .next() - .expect("Expected 1 len Vec to have at least 1 item")) - } else { - Err(Self::error(ActionErrorKind::MultipleChildren(errors))) - } + Ok(()) } } From da33c23470d79a0247502e89ca348f3556959374 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 10 Nov 2023 10:38:40 -0800 Subject: [PATCH 10/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb78c8ff5..17a71d78e 100644 --- a/README.md +++ b/README.md @@ -435,7 +435,7 @@ The Determinate Nix installer has numerous advantages: * supporting a expanded test suite including 'curing' cases * supporting SELinux and OSTree based distributions without asking users to make compromises * operating as a single, static binary with external dependencies such as `openssl`, only calling existing system tools (like `useradd`) where necessary -* supports remote building out of the box +* As a MacOS remote build target, ensures `nix` is not absent from path It has been wonderful to collaborate with other participants in the Nix Installer Working Group and members of the broader community. The working group maintains a [foundation owned fork of the installer](https://github.com/nixos/experimental-nix-installer/). From 42c512717688faf843c207586d98c9d78ec31bc3 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 13:41:30 -0500 Subject: [PATCH 11/12] Update src/cli/subcommand/repair.rs Co-authored-by: Ana Hobden --- src/cli/subcommand/repair.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli/subcommand/repair.rs b/src/cli/subcommand/repair.rs index ac2b4a994..ed20b2fee 100644 --- a/src/cli/subcommand/repair.rs +++ b/src/cli/subcommand/repair.rs @@ -40,7 +40,8 @@ impl CommandExecute for Repair { println!("{:#?}", err); return Ok(ExitCode::FAILURE); } - +// TODO: Using `cfg` based on OS is not a long term solution. +// Make this read the planner from the `/nix/receipt.json` to determine which tasks to run. #[cfg(target_os = "macos")] { let mut reconfigure = crate::action::macos::ConfigureRemoteBuilding::plan() From e6f9956170d001cf3e38546cf0ab01b851a24f5c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 10 Nov 2023 13:43:42 -0500 Subject: [PATCH 12/12] Update src/cli/subcommand/repair.rs --- src/cli/subcommand/repair.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/subcommand/repair.rs b/src/cli/subcommand/repair.rs index ed20b2fee..243ff20ad 100644 --- a/src/cli/subcommand/repair.rs +++ b/src/cli/subcommand/repair.rs @@ -40,8 +40,8 @@ impl CommandExecute for Repair { println!("{:#?}", err); return Ok(ExitCode::FAILURE); } -// TODO: Using `cfg` based on OS is not a long term solution. -// Make this read the planner from the `/nix/receipt.json` to determine which tasks to run. + // TODO: Using `cfg` based on OS is not a long term solution. + // Make this read the planner from the `/nix/receipt.json` to determine which tasks to run. #[cfg(target_os = "macos")] { let mut reconfigure = crate::action::macos::ConfigureRemoteBuilding::plan()