From e57311a80774908c1a734ee0e477a39b0e088de5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 09:58:53 -0800 Subject: [PATCH 01/22] Install can detect existing /nix/receipt.json --- src/cli/subcommand/install.rs | 60 ++++++++++++++++++++++++++------- src/cli/subcommand/uninstall.rs | 4 +-- src/plan.rs | 4 ++- src/planner/mod.rs | 13 +++++++ 4 files changed, 66 insertions(+), 15 deletions(-) diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 38f1fc8..15b0f9a 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -1,6 +1,9 @@ -use std::{path::PathBuf, process::ExitCode}; +use std::{ + path::{Path, PathBuf}, + process::ExitCode, +}; -use crate::BuiltinPlanner; +use crate::{plan::RECEIPT_LOCATION, BuiltinPlanner, InstallPlan, Planner}; use clap::{ArgAction, Parser}; use eyre::{eyre, WrapErr}; @@ -8,7 +11,7 @@ use crate::{cli::CommandExecute, interaction}; /// Execute an install (possibly using an existing plan) #[derive(Debug, Parser)] -#[command(args_conflicts_with_subcommands = true)] +#[command(args_conflicts_with_subcommands = true, arg_required_else_help = true)] pub struct Install { #[clap( long, @@ -29,7 +32,7 @@ pub struct Install { pub plan: Option, #[clap(subcommand)] - pub planner: BuiltinPlanner, + pub planner: Option, } #[async_trait::async_trait] @@ -43,28 +46,61 @@ impl CommandExecute for Install { explain, } = self; - let mut plan = match &plan { - Some(plan_path) => { - let install_plan_string = tokio::fs::read_to_string(&plan_path) + let existing_receipt: Option = match Path::new(RECEIPT_LOCATION).exists() { + true => { + let install_plan_string = tokio::fs::read_to_string(&RECEIPT_LOCATION) .await .wrap_err("Reading plan")?; + Some(serde_json::from_str(&install_plan_string)?) + }, + false => None, + }; + + let mut install_plan = match (planner, plan) { + (Some(planner), None) => { + let chosen_planner: Box = planner.clone().boxed(); + + match existing_receipt { + Some(existing_receipt) => { + if existing_receipt.planner.typetag_name() == chosen_planner.typetag_name() { + existing_receipt + } else { + return Err(eyre!("Found existing plan in `/nix/receipt.json` which used a different planner, try uninstalling the existing install")) + } + } , + None => { + planner.plan().await.map_err(|e| eyre!(e))? + }, + } + }, + (None, Some(plan_path)) => { + let install_plan_string = tokio::fs::read_to_string(&plan_path) + .await + .wrap_err("Reading plan")?; serde_json::from_str(&install_plan_string)? }, - None => planner.plan().await.map_err(|e| eyre!(e))?, + (None, None) => return Err(eyre!("`--plan` or a planner is required")), + (Some(_), Some(_)) => return Err(eyre!("`--plan` conflicts with passing a planner, a planner creates plans, so passing an existing plan doesn't make sense")), }; if !no_confirm { - if !interaction::confirm(plan.describe_execute(explain).map_err(|e| eyre!(e))?).await? { + if !interaction::confirm( + install_plan + .describe_execute(explain) + .map_err(|e| eyre!(e))?, + ) + .await? + { interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; } } - if let Err(err) = plan.install().await { + if let Err(err) = install_plan.install().await { tracing::error!("{:?}", eyre!(err)); - if !interaction::confirm(plan.describe_revert(explain)).await? { + if !interaction::confirm(install_plan.describe_revert(explain)).await? { interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; } - plan.revert().await? + install_plan.revert().await? } Ok(ExitCode::SUCCESS) diff --git a/src/cli/subcommand/uninstall.rs b/src/cli/subcommand/uninstall.rs index af242d7..5f2db68 100644 --- a/src/cli/subcommand/uninstall.rs +++ b/src/cli/subcommand/uninstall.rs @@ -1,6 +1,6 @@ use std::{path::PathBuf, process::ExitCode}; -use crate::InstallPlan; +use crate::{plan::RECEIPT_LOCATION, InstallPlan}; use clap::{ArgAction, Parser}; use eyre::WrapErr; @@ -23,7 +23,7 @@ pub struct Uninstall { global = true )] pub explain: bool, - #[clap(default_value = "/nix/receipt.json")] + #[clap(default_value = RECEIPT_LOCATION)] pub receipt: PathBuf, } diff --git a/src/plan.rs b/src/plan.rs index c661787..eb42033 100644 --- a/src/plan.rs +++ b/src/plan.rs @@ -8,6 +8,8 @@ use crate::{ HarmonicError, }; +pub const RECEIPT_LOCATION: &str = "/nix/receipt.json"; + #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct InstallPlan { pub(crate) actions: Vec>, @@ -166,7 +168,7 @@ async fn write_receipt(plan: InstallPlan) -> Result<(), HarmonicError> { tokio::fs::create_dir_all("/nix") .await .map_err(|e| HarmonicError::RecordingReceipt(PathBuf::from("/nix"), e))?; - let install_receipt_path = PathBuf::from("/nix/receipt.json"); + let install_receipt_path = PathBuf::from(RECEIPT_LOCATION); let self_json = serde_json::to_string_pretty(&plan).map_err(HarmonicError::SerializingReceipt)?; tokio::fs::write(&install_receipt_path, self_json) diff --git a/src/planner/mod.rs b/src/planner/mod.rs index 4dd3dfa..4d4d9d0 100644 --- a/src/planner/mod.rs +++ b/src/planner/mod.rs @@ -16,6 +16,12 @@ pub trait Planner: std::fmt::Debug + Send + Sync + dyn_clone::DynClone { fn describe( &self, ) -> Result, Box>; + fn boxed(self) -> Box + where + Self: Sized + 'static, + { + Box::new(self) + } } dyn_clone::clone_trait_object!(Planner); @@ -56,6 +62,13 @@ impl BuiltinPlanner { BuiltinPlanner::SteamDeck(planner) => planner.plan().await, } } + pub fn boxed(self) -> Box { + match self { + BuiltinPlanner::LinuxMulti(i) => i.boxed(), + BuiltinPlanner::DarwinMulti(i) => i.boxed(), + BuiltinPlanner::SteamDeck(i) => i.boxed(), + } + } } #[derive(thiserror::Error, Debug)] From 72d3fcd9429beaa719cd839f5fb25a4f7001ad2a Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 10:18:05 -0800 Subject: [PATCH 02/22] Detect if plan already done --- src/action/common/configure_nix.rs | 4 ++++ src/action/common/configure_nix_daemon_service.rs | 4 ++++ src/action/common/configure_shell_profile.rs | 4 ++++ src/action/common/create_directory.rs | 4 ++++ src/action/common/create_file.rs | 4 ++++ src/action/common/create_group.rs | 4 ++++ src/action/common/create_nix_tree.rs | 4 ++++ src/action/common/create_or_append_file.rs | 4 ++++ src/action/common/create_user.rs | 4 ++++ src/action/common/create_users_and_group.rs | 4 ++++ src/action/common/fetch_nix.rs | 4 ++++ src/action/common/move_unpacked_nix.rs | 4 ++++ src/action/common/place_channel_configuration.rs | 4 ++++ src/action/common/place_nix_configuration.rs | 4 ++++ src/action/common/provision_nix.rs | 4 ++++ src/action/common/setup_default_profile.rs | 4 ++++ src/action/darwin/bootstrap_volume.rs | 4 ++++ src/action/darwin/create_apfs_volume.rs | 4 ++++ src/action/darwin/create_synthetic_objects.rs | 4 ++++ src/action/darwin/create_volume.rs | 4 ++++ src/action/darwin/enable_ownership.rs | 4 ++++ src/action/darwin/encrypt_volume.rs | 4 ++++ src/action/darwin/kickstart_launchctl_service.rs | 4 ++++ src/action/darwin/unmount_volume.rs | 4 ++++ src/action/linux/create_systemd_sysext.rs | 4 ++++ src/action/linux/start_systemd_unit.rs | 4 ++++ src/action/linux/systemd_sysext_merge.rs | 4 ++++ src/action/mod.rs | 3 ++- src/cli/subcommand/install.rs | 14 ++++++++++---- src/plan.rs | 2 +- src/planner/darwin/multi.rs | 2 +- src/planner/linux/multi.rs | 2 +- src/planner/mod.rs | 2 +- src/planner/specific/steam_deck.rs | 2 +- 34 files changed, 125 insertions(+), 10 deletions(-) diff --git a/src/action/common/configure_nix.rs b/src/action/common/configure_nix.rs index c088c7c..214cdc1 100644 --- a/src/action/common/configure_nix.rs +++ b/src/action/common/configure_nix.rs @@ -184,4 +184,8 @@ impl Action for ConfigureNix { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } diff --git a/src/action/common/configure_nix_daemon_service.rs b/src/action/common/configure_nix_daemon_service.rs index 5e810fd..e74bd70 100644 --- a/src/action/common/configure_nix_daemon_service.rs +++ b/src/action/common/configure_nix_daemon_service.rs @@ -212,6 +212,10 @@ impl Action for ConfigureNixDaemonService { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/configure_shell_profile.rs b/src/action/common/configure_shell_profile.rs index f84c5dc..8a903da 100644 --- a/src/action/common/configure_shell_profile.rs +++ b/src/action/common/configure_shell_profile.rs @@ -181,6 +181,10 @@ impl Action for ConfigureShellProfile { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_directory.rs b/src/action/common/create_directory.rs index b67fe76..e40edda 100644 --- a/src/action/common/create_directory.rs +++ b/src/action/common/create_directory.rs @@ -214,6 +214,10 @@ impl Action for CreateDirectory { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_file.rs b/src/action/common/create_file.rs index 08b4c54..9b462f2 100644 --- a/src/action/common/create_file.rs +++ b/src/action/common/create_file.rs @@ -188,6 +188,10 @@ impl Action for CreateFile { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_group.rs b/src/action/common/create_group.rs index 2ac3971..4c81ff3 100644 --- a/src/action/common/create_group.rs +++ b/src/action/common/create_group.rs @@ -160,6 +160,10 @@ impl Action for CreateGroup { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_nix_tree.rs b/src/action/common/create_nix_tree.rs index ab4d1e3..c96e00e 100644 --- a/src/action/common/create_nix_tree.rs +++ b/src/action/common/create_nix_tree.rs @@ -134,6 +134,10 @@ impl Action for CreateNixTree { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_or_append_file.rs b/src/action/common/create_or_append_file.rs index 81ad802..d4c6e52 100644 --- a/src/action/common/create_or_append_file.rs +++ b/src/action/common/create_or_append_file.rs @@ -223,6 +223,10 @@ impl Action for CreateOrAppendFile { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_user.rs b/src/action/common/create_user.rs index 40a6086..589b26a 100644 --- a/src/action/common/create_user.rs +++ b/src/action/common/create_user.rs @@ -254,6 +254,10 @@ impl Action for CreateUser { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/create_users_and_group.rs b/src/action/common/create_users_and_group.rs index 3b2cd62..619eb3c 100644 --- a/src/action/common/create_users_and_group.rs +++ b/src/action/common/create_users_and_group.rs @@ -229,6 +229,10 @@ impl Action for CreateUsersAndGroup { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/fetch_nix.rs b/src/action/common/fetch_nix.rs index 47f7349..e1f111b 100644 --- a/src/action/common/fetch_nix.rs +++ b/src/action/common/fetch_nix.rs @@ -115,6 +115,10 @@ impl Action for FetchNix { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/move_unpacked_nix.rs b/src/action/common/move_unpacked_nix.rs index 6638cec..d545e23 100644 --- a/src/action/common/move_unpacked_nix.rs +++ b/src/action/common/move_unpacked_nix.rs @@ -106,6 +106,10 @@ impl Action for MoveUnpackedNix { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/place_channel_configuration.rs b/src/action/common/place_channel_configuration.rs index ca424c1..a44a5ac 100644 --- a/src/action/common/place_channel_configuration.rs +++ b/src/action/common/place_channel_configuration.rs @@ -130,6 +130,10 @@ impl Action for PlaceChannelConfiguration { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/place_nix_configuration.rs b/src/action/common/place_nix_configuration.rs index 1e513ef..9aa444a 100644 --- a/src/action/common/place_nix_configuration.rs +++ b/src/action/common/place_nix_configuration.rs @@ -115,6 +115,10 @@ impl Action for PlaceNixConfiguration { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/provision_nix.rs b/src/action/common/provision_nix.rs index 60f9302..937e74d 100644 --- a/src/action/common/provision_nix.rs +++ b/src/action/common/provision_nix.rs @@ -168,6 +168,10 @@ impl Action for ProvisionNix { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/common/setup_default_profile.rs b/src/action/common/setup_default_profile.rs index 38618f3..5e8efb3 100644 --- a/src/action/common/setup_default_profile.rs +++ b/src/action/common/setup_default_profile.rs @@ -181,6 +181,10 @@ impl Action for SetupDefaultProfile { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/bootstrap_volume.rs b/src/action/darwin/bootstrap_volume.rs index ecdb447..f9f0530 100644 --- a/src/action/darwin/bootstrap_volume.rs +++ b/src/action/darwin/bootstrap_volume.rs @@ -106,6 +106,10 @@ impl Action for BootstrapVolume { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/create_apfs_volume.rs b/src/action/darwin/create_apfs_volume.rs index 2d280fd..c6a8cf5 100644 --- a/src/action/darwin/create_apfs_volume.rs +++ b/src/action/darwin/create_apfs_volume.rs @@ -289,6 +289,10 @@ impl Action for CreateApfsVolume { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/create_synthetic_objects.rs b/src/action/darwin/create_synthetic_objects.rs index 94a43e4..97c2604 100644 --- a/src/action/darwin/create_synthetic_objects.rs +++ b/src/action/darwin/create_synthetic_objects.rs @@ -98,6 +98,10 @@ impl Action for CreateSyntheticObjects { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/create_volume.rs b/src/action/darwin/create_volume.rs index 49a7899..de02144 100644 --- a/src/action/darwin/create_volume.rs +++ b/src/action/darwin/create_volume.rs @@ -130,6 +130,10 @@ impl Action for CreateVolume { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/enable_ownership.rs b/src/action/darwin/enable_ownership.rs index 3e627ea..a1a456b 100644 --- a/src/action/darwin/enable_ownership.rs +++ b/src/action/darwin/enable_ownership.rs @@ -109,6 +109,10 @@ impl Action for EnableOwnership { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/encrypt_volume.rs b/src/action/darwin/encrypt_volume.rs index 8e8f5c3..d982177 100644 --- a/src/action/darwin/encrypt_volume.rs +++ b/src/action/darwin/encrypt_volume.rs @@ -86,6 +86,10 @@ impl Action for EncryptVolume { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/kickstart_launchctl_service.rs b/src/action/darwin/kickstart_launchctl_service.rs index c98eed8..2566ae1 100644 --- a/src/action/darwin/kickstart_launchctl_service.rs +++ b/src/action/darwin/kickstart_launchctl_service.rs @@ -96,6 +96,10 @@ impl Action for KickstartLaunchctlService { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/darwin/unmount_volume.rs b/src/action/darwin/unmount_volume.rs index 834cea3..70cad7c 100644 --- a/src/action/darwin/unmount_volume.rs +++ b/src/action/darwin/unmount_volume.rs @@ -117,6 +117,10 @@ impl Action for UnmountVolume { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/linux/create_systemd_sysext.rs b/src/action/linux/create_systemd_sysext.rs index 36c617a..c9dde74 100644 --- a/src/action/linux/create_systemd_sysext.rs +++ b/src/action/linux/create_systemd_sysext.rs @@ -185,6 +185,10 @@ impl Action for CreateSystemdSysext { *action_state = ActionState::Uncompleted; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/linux/start_systemd_unit.rs b/src/action/linux/start_systemd_unit.rs index 7f36f57..21fc16d 100644 --- a/src/action/linux/start_systemd_unit.rs +++ b/src/action/linux/start_systemd_unit.rs @@ -98,6 +98,10 @@ impl Action for StartSystemdUnit { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/linux/systemd_sysext_merge.rs b/src/action/linux/systemd_sysext_merge.rs index 332192f..9d74d72 100644 --- a/src/action/linux/systemd_sysext_merge.rs +++ b/src/action/linux/systemd_sysext_merge.rs @@ -102,6 +102,10 @@ impl Action for SystemdSysextMerge { *action_state = ActionState::Completed; Ok(()) } + + fn action_state(&self) -> ActionState { + self.action_state + } } #[derive(Debug, thiserror::Error)] diff --git a/src/action/mod.rs b/src/action/mod.rs index 508e49d..99ef567 100644 --- a/src/action/mod.rs +++ b/src/action/mod.rs @@ -13,11 +13,12 @@ pub trait Action: Send + Sync + std::fmt::Debug + dyn_clone::DynClone { // They should also have an `async fn plan(args...) -> Result, Box>;` async fn execute(&mut self) -> Result<(), Box>; async fn revert(&mut self) -> Result<(), Box>; + fn action_state(&self) -> ActionState; } dyn_clone::clone_trait_object!(Action); -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Copy)] pub enum ActionState { Completed, // Only applicable to meta-actions that start multiple sub-actions. diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 15b0f9a..daa1f33 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -3,7 +3,7 @@ use std::{ process::ExitCode, }; -use crate::{plan::RECEIPT_LOCATION, BuiltinPlanner, InstallPlan, Planner}; +use crate::{plan::RECEIPT_LOCATION, BuiltinPlanner, InstallPlan, Planner, action::ActionState}; use clap::{ArgAction, Parser}; use eyre::{eyre, WrapErr}; @@ -62,11 +62,17 @@ impl CommandExecute for Install { match existing_receipt { Some(existing_receipt) => { - if existing_receipt.planner.typetag_name() == chosen_planner.typetag_name() { - existing_receipt - } else { + if existing_receipt.planner.typetag_name() != chosen_planner.typetag_name() { return Err(eyre!("Found existing plan in `/nix/receipt.json` which used a different planner, try uninstalling the existing install")) } + if existing_receipt.planner.settings().map_err(|e| eyre!(e))? != chosen_planner.settings().map_err(|e| eyre!(e))? { + return Err(eyre!("Found existing plan in `/nix/receipt.json` which used different planner settings, try uninstalling the existing install")) + } + if existing_receipt.actions.iter().all(|v| v.action_state() == ActionState::Completed) { + return Err(eyre!("Found existing plan in `/nix/receipt.json`, with the same settings, already completed, try uninstalling and reinstalling if Nix isn't working")) + } + + existing_receipt } , None => { planner.plan().await.map_err(|e| eyre!(e))? diff --git a/src/plan.rs b/src/plan.rs index eb42033..a1aaee1 100644 --- a/src/plan.rs +++ b/src/plan.rs @@ -45,7 +45,7 @@ impl InstallPlan { }, planner = planner.typetag_name(), plan_settings = planner - .describe()? + .settings()? .into_iter() .map(|(k, v)| format!("* {k}: {v}", k = k.bold().white())) .collect::>() diff --git a/src/planner/darwin/multi.rs b/src/planner/darwin/multi.rs index 08da5eb..e677b9c 100644 --- a/src/planner/darwin/multi.rs +++ b/src/planner/darwin/multi.rs @@ -98,7 +98,7 @@ impl Planner for DarwinMulti { }) } - fn describe( + fn settings( &self, ) -> Result, Box> { let Self { diff --git a/src/planner/linux/multi.rs b/src/planner/linux/multi.rs index 54aa3aa..a9f47d1 100644 --- a/src/planner/linux/multi.rs +++ b/src/planner/linux/multi.rs @@ -36,7 +36,7 @@ impl Planner for LinuxMulti { }) } - fn describe( + fn settings( &self, ) -> Result, Box> { let Self { settings } = self; diff --git a/src/planner/mod.rs b/src/planner/mod.rs index 4d4d9d0..f3a2bf0 100644 --- a/src/planner/mod.rs +++ b/src/planner/mod.rs @@ -13,7 +13,7 @@ pub trait Planner: std::fmt::Debug + Send + Sync + dyn_clone::DynClone { where Self: Sized; async fn plan(self) -> Result>; - fn describe( + fn settings( &self, ) -> Result, Box>; fn boxed(self) -> Box diff --git a/src/planner/specific/steam_deck.rs b/src/planner/specific/steam_deck.rs index 99ee2bc..9ad73a0 100644 --- a/src/planner/specific/steam_deck.rs +++ b/src/planner/specific/steam_deck.rs @@ -36,7 +36,7 @@ impl Planner for SteamDeck { }) } - fn describe( + fn settings( &self, ) -> Result, Box> { let Self { settings } = self; From 00ffe96aaecafa100f4f24d6993528fc94b1d91b Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 10:20:48 -0800 Subject: [PATCH 03/22] Refine plan subcommand UX --- src/cli/subcommand/plan.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/subcommand/plan.rs b/src/cli/subcommand/plan.rs index 96cdd43..41c3796 100644 --- a/src/cli/subcommand/plan.rs +++ b/src/cli/subcommand/plan.rs @@ -9,19 +9,19 @@ use crate::cli::CommandExecute; /// Plan an install that can be repeated on an identical host later #[derive(Debug, Parser)] -#[command(multicall = true)] +#[command(args_conflicts_with_subcommands = true, arg_required_else_help = true)] pub struct Plan { #[clap(subcommand)] pub planner: Option, #[clap(env = "HARMONIC_PLAN")] - pub plan: PathBuf, + pub output: PathBuf, } #[async_trait::async_trait] impl CommandExecute for Plan { #[tracing::instrument(skip_all, fields())] async fn execute(self) -> eyre::Result { - let Self { planner, plan } = self; + let Self { planner, output } = self; let planner = match planner { Some(planner) => planner, @@ -33,7 +33,7 @@ impl CommandExecute for Plan { let install_plan = planner.plan().await.map_err(|e| eyre::eyre!(e))?; let json = serde_json::to_string_pretty(&install_plan)?; - tokio::fs::write(plan, json) + tokio::fs::write(output, json) .await .wrap_err("Writing plan")?; From 658c3ddde767cd69a6dd2b301f73058d22885e91 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 10:31:11 -0800 Subject: [PATCH 04/22] fmt --- src/cli/subcommand/install.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index daa1f33..329f3ee 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -3,7 +3,7 @@ use std::{ process::ExitCode, }; -use crate::{plan::RECEIPT_LOCATION, BuiltinPlanner, InstallPlan, Planner, action::ActionState}; +use crate::{action::ActionState, plan::RECEIPT_LOCATION, BuiltinPlanner, InstallPlan, Planner}; use clap::{ArgAction, Parser}; use eyre::{eyre, WrapErr}; @@ -71,7 +71,6 @@ impl CommandExecute for Install { if existing_receipt.actions.iter().all(|v| v.action_state() == ActionState::Completed) { return Err(eyre!("Found existing plan in `/nix/receipt.json`, with the same settings, already completed, try uninstalling and reinstalling if Nix isn't working")) } - existing_receipt } , None => { From 04210490aa826567fddc71c9372bf5aa7c4fe2d4 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 11:22:08 -0800 Subject: [PATCH 05/22] Add new CI jobs that test install/uninstall --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a938dbb..16e7903 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,31 @@ jobs: path: | result/bin/harmonic + RunX86Linux: + runs-on: ubuntu-latest + needs: BuildX86Linux + env: + RUST_LOG: harmonic=trace + RUST_BACKTRACE: full + steps: + - uses: actions/download-artifact@v3 + with: + name: harmonic-x86_64-linux + path: harmonic + - name: Set executable + run: chmod +x ./harmonic + - name: Initial install + run: ./harmonic install linux-multi --no-confirm + - name: Test run + run: nix run nixpkgs#fortune + - name: Initial uninstall + run: ./harmonic uninstall --no-confirm + - name: Repeated install + run: ./harmonic install linux-multi --no-confirm + - name: Repeated uninstall + run: ./harmonic uninstall --no-confirm + + BuildX86Darwin: runs-on: macos-latest steps: @@ -99,3 +124,26 @@ jobs: name: harmonic-x86_64-darwin path: | result/bin/harmonic + + RunX86Darwin: + runs-on: macos-latest + needs: BuildX86Darwin + env: + RUST_LOG: harmonic=trace + RUST_BACKTRACE: full + steps: + - uses: actions/download-artifact@v3 + with: + name: harmonic-x86_64-darwin + path: harmonic + - name: Initial install + run: ./harmonic install darwin-multi --no-confirm + - name: Test run + run: nix run nixpkgs#fortune + - name: Initial uninstall + run: ./harmonic uninstall --no-confirm + - name: Repeated install + run: ./harmonic install darwin-multi --no-confirm + - name: Repeated uninstall + run: ./harmonic uninstall --no-confirm + \ No newline at end of file From eec8479c79c4ca1809d46823d2b5c396e22a24e3 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 11:30:49 -0800 Subject: [PATCH 06/22] Laugh at the sheer ridiculousness of my life --- .github/workflows/ci.yml | 88 ++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16e7903..e53c6ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,29 +82,29 @@ jobs: path: | result/bin/harmonic - RunX86Linux: - runs-on: ubuntu-latest - needs: BuildX86Linux - env: - RUST_LOG: harmonic=trace - RUST_BACKTRACE: full - steps: - - uses: actions/download-artifact@v3 - with: - name: harmonic-x86_64-linux - path: harmonic - - name: Set executable - run: chmod +x ./harmonic - - name: Initial install - run: ./harmonic install linux-multi --no-confirm - - name: Test run - run: nix run nixpkgs#fortune - - name: Initial uninstall - run: ./harmonic uninstall --no-confirm - - name: Repeated install - run: ./harmonic install linux-multi --no-confirm - - name: Repeated uninstall - run: ./harmonic uninstall --no-confirm + RunX86Linux: + runs-on: ubuntu-latest + needs: BuildX86Linux + env: + RUST_LOG: harmonic=trace + RUST_BACKTRACE: full + steps: + - uses: actions/download-artifact@v3 + with: + name: harmonic-x86_64-linux + path: harmonic + - name: Set executable + run: chmod +x ./harmonic + - name: Initial install + run: ./harmonic install linux-multi --no-confirm + - name: Test run + run: nix run nixpkgs#fortune + - name: Initial uninstall + run: ./harmonic uninstall --no-confirm + - name: Repeated install + run: ./harmonic install linux-multi --no-confirm + - name: Repeated uninstall + run: ./harmonic uninstall --no-confirm BuildX86Darwin: @@ -125,25 +125,25 @@ jobs: path: | result/bin/harmonic - RunX86Darwin: - runs-on: macos-latest - needs: BuildX86Darwin - env: - RUST_LOG: harmonic=trace - RUST_BACKTRACE: full - steps: - - uses: actions/download-artifact@v3 - with: - name: harmonic-x86_64-darwin - path: harmonic - - name: Initial install - run: ./harmonic install darwin-multi --no-confirm - - name: Test run - run: nix run nixpkgs#fortune - - name: Initial uninstall - run: ./harmonic uninstall --no-confirm - - name: Repeated install - run: ./harmonic install darwin-multi --no-confirm - - name: Repeated uninstall - run: ./harmonic uninstall --no-confirm + RunX86Darwin: + runs-on: macos-latest + needs: BuildX86Darwin + env: + RUST_LOG: harmonic=trace + RUST_BACKTRACE: full + steps: + - uses: actions/download-artifact@v3 + with: + name: harmonic-x86_64-darwin + path: harmonic + - name: Initial install + run: ./harmonic install darwin-multi --no-confirm + - name: Test run + run: nix run nixpkgs#fortune + - name: Initial uninstall + run: ./harmonic uninstall --no-confirm + - name: Repeated install + run: ./harmonic install darwin-multi --no-confirm + - name: Repeated uninstall + run: ./harmonic uninstall --no-confirm \ No newline at end of file From bb298efbdb14c498052f0485fff165bf39db7359 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 11:48:12 -0800 Subject: [PATCH 07/22] Use artifact names better --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e53c6ed..cd367ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,10 @@ jobs: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-linux - path: harmonic + - name: Rename artifact + run: | + ls -R + mv harmonic-x86_64-linux harmonic - name: Set executable run: chmod +x ./harmonic - name: Initial install @@ -135,7 +138,10 @@ jobs: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-darwin - path: harmonic + - name: Rename artifact + run: | + ls -R + mv harmonic-x86_64-darwin harmonic - name: Initial install run: ./harmonic install darwin-multi --no-confirm - name: Test run From d900830f040b91cfb8662f6a2b460a892cfb99c0 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 12:07:34 -0800 Subject: [PATCH 08/22] No rename --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd367ec..2e7cfc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,10 +92,6 @@ jobs: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-linux - - name: Rename artifact - run: | - ls -R - mv harmonic-x86_64-linux harmonic - name: Set executable run: chmod +x ./harmonic - name: Initial install @@ -138,10 +134,6 @@ jobs: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-darwin - - name: Rename artifact - run: | - ls -R - mv harmonic-x86_64-darwin harmonic - name: Initial install run: ./harmonic install darwin-multi --no-confirm - name: Test run From 47ae6398f81c5ded971a280d26704c0c4adc1c8e Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 12:21:02 -0800 Subject: [PATCH 09/22] Use sudo and don't try to prompt on no-confirm --- .github/workflows/ci.yml | 8 ++++---- src/cli/subcommand/install.rs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e7cfc3..c9e652f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -135,13 +135,13 @@ jobs: with: name: harmonic-x86_64-darwin - name: Initial install - run: ./harmonic install darwin-multi --no-confirm + run: sudo ./harmonic install darwin-multi --no-confirm - name: Test run run: nix run nixpkgs#fortune - name: Initial uninstall - run: ./harmonic uninstall --no-confirm + run: sudo ./harmonic uninstall --no-confirm - name: Repeated install - run: ./harmonic install darwin-multi --no-confirm + run: sudo ./harmonic install darwin-multi --no-confirm - name: Repeated uninstall - run: ./harmonic uninstall --no-confirm + run: sudo ./harmonic uninstall --no-confirm \ No newline at end of file diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 38f1fc8..1d69d4e 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -61,8 +61,10 @@ impl CommandExecute for Install { if let Err(err) = plan.install().await { tracing::error!("{:?}", eyre!(err)); - if !interaction::confirm(plan.describe_revert(explain)).await? { - interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; + if !no_confirm { + if !interaction::confirm(plan.describe_revert(explain)).await? { + interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; + } } plan.revert().await? } From 1a88add8c5b920cd3d173f5f469648acc68169ee Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 12:48:49 -0800 Subject: [PATCH 10/22] use sudo on linux as well... --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9e652f..222d2ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,15 +95,15 @@ jobs: - name: Set executable run: chmod +x ./harmonic - name: Initial install - run: ./harmonic install linux-multi --no-confirm + run: sudo ./harmonic install linux-multi --no-confirm - name: Test run run: nix run nixpkgs#fortune - name: Initial uninstall - run: ./harmonic uninstall --no-confirm + run: sudo ./harmonic uninstall --no-confirm - name: Repeated install - run: ./harmonic install linux-multi --no-confirm + run: sudo ./harmonic install linux-multi --no-confirm - name: Repeated uninstall - run: ./harmonic uninstall --no-confirm + run: sudo ./harmonic uninstall --no-confirm BuildX86Darwin: From d56421d3456a5102e04f04afd329a1b6ba1a13c3 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 13:04:19 -0800 Subject: [PATCH 11/22] Do a better job setting env vars --- .github/workflows/ci.yml | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 222d2ea..3f7b14e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,9 +85,6 @@ jobs: RunX86Linux: runs-on: ubuntu-latest needs: BuildX86Linux - env: - RUST_LOG: harmonic=trace - RUST_BACKTRACE: full steps: - uses: actions/download-artifact@v3 with: @@ -95,15 +92,17 @@ jobs: - name: Set executable run: chmod +x ./harmonic - name: Initial install - run: sudo ./harmonic install linux-multi --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm - name: Test run - run: nix run nixpkgs#fortune + run: | + source + nix run nixpkgs#fortune - name: Initial uninstall - run: sudo ./harmonic uninstall --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm - name: Repeated install - run: sudo ./harmonic install linux-multi --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm - name: Repeated uninstall - run: sudo ./harmonic uninstall --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm BuildX86Darwin: @@ -127,21 +126,20 @@ jobs: RunX86Darwin: runs-on: macos-latest needs: BuildX86Darwin - env: - RUST_LOG: harmonic=trace - RUST_BACKTRACE: full steps: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-darwin - name: Initial install - run: sudo ./harmonic install darwin-multi --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm - name: Test run - run: nix run nixpkgs#fortune + run: | + source + nix run nixpkgs#fortune - name: Initial uninstall - run: sudo ./harmonic uninstall --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm - name: Repeated install - run: sudo ./harmonic install darwin-multi --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm - name: Repeated uninstall - run: sudo ./harmonic uninstall --no-confirm + run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm \ No newline at end of file From fb4d1c72800e5c9b61a44a8dfba1f7b3cf652400 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 13:21:32 -0800 Subject: [PATCH 12/22] source the nix file after install --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f7b14e..adb6c1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm - name: Test run run: | - source + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh nix run nixpkgs#fortune - name: Initial uninstall run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm @@ -134,7 +134,7 @@ jobs: run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm - name: Test run run: | - source + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh nix run nixpkgs#fortune - name: Initial uninstall run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm From 6ef10ff50ea62b16495fac094825d6f919f163d1 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 13:43:06 -0800 Subject: [PATCH 13/22] Use systemctl disable not enable, don't auto revert in no-confirm --- src/action/linux/start_systemd_unit.rs | 10 +++++++--- src/cli/subcommand/install.rs | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/action/linux/start_systemd_unit.rs b/src/action/linux/start_systemd_unit.rs index 7f36f57..5a21f77 100644 --- a/src/action/linux/start_systemd_unit.rs +++ b/src/action/linux/start_systemd_unit.rs @@ -90,9 +90,13 @@ impl Action for StartSystemdUnit { tracing::debug!("Stopping systemd unit"); // TODO(@Hoverbear): Handle proxy vars - execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}"))) - .await - .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; + execute_command( + Command::new("systemctl") + .arg("disable") + .arg(format!("{unit}")), + ) + .await + .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; tracing::trace!("Stopped systemd unit"); *action_state = ActionState::Completed; diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 1d69d4e..4d544d3 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -65,8 +65,10 @@ impl CommandExecute for Install { if !interaction::confirm(plan.describe_revert(explain)).await? { interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; } + plan.revert().await? + } else { + return Err(err).wrap_err("Install failure"); } - plan.revert().await? } Ok(ExitCode::SUCCESS) From 4ea3cd221d186eb6dc7f3e92d34a3d31d23bd91f Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 13:53:56 -0800 Subject: [PATCH 14/22] Actually try to build working code --- src/cli/subcommand/install.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 4d544d3..b208416 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -60,14 +60,15 @@ impl CommandExecute for Install { } if let Err(err) = plan.install().await { - tracing::error!("{:?}", eyre!(err)); + let error = eyre!(err).wrap_err("Install failure"); if !no_confirm { + tracing::error!("{:?}", error); if !interaction::confirm(plan.describe_revert(explain)).await? { interaction::clean_exit_with_message("Okay, didn't do anything! Bye!").await; } plan.revert().await? } else { - return Err(err).wrap_err("Install failure"); + return Err(error); } } From 71e63da4e4788536196e368d10b268e4346f6706 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 8 Nov 2022 14:11:45 -0800 Subject: [PATCH 15/22] undo change --- src/action/linux/start_systemd_unit.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/action/linux/start_systemd_unit.rs b/src/action/linux/start_systemd_unit.rs index 5a21f77..7f36f57 100644 --- a/src/action/linux/start_systemd_unit.rs +++ b/src/action/linux/start_systemd_unit.rs @@ -90,13 +90,9 @@ impl Action for StartSystemdUnit { tracing::debug!("Stopping systemd unit"); // TODO(@Hoverbear): Handle proxy vars - execute_command( - Command::new("systemctl") - .arg("disable") - .arg(format!("{unit}")), - ) - .await - .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; + execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}"))) + .await + .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; tracing::trace!("Stopped systemd unit"); *action_state = ActionState::Completed; From 83dde40db95a620c271b2aeae7479c7b783b84e5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 9 Nov 2022 08:45:13 -0800 Subject: [PATCH 16/22] Use const in error messages --- src/cli/subcommand/install.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cli/subcommand/install.rs b/src/cli/subcommand/install.rs index 329f3ee..b190b97 100644 --- a/src/cli/subcommand/install.rs +++ b/src/cli/subcommand/install.rs @@ -63,13 +63,13 @@ impl CommandExecute for Install { match existing_receipt { Some(existing_receipt) => { if existing_receipt.planner.typetag_name() != chosen_planner.typetag_name() { - return Err(eyre!("Found existing plan in `/nix/receipt.json` which used a different planner, try uninstalling the existing install")) + return Err(eyre!("Found existing plan in `{RECEIPT_LOCATION}` which used a different planner, try uninstalling the existing install")) } if existing_receipt.planner.settings().map_err(|e| eyre!(e))? != chosen_planner.settings().map_err(|e| eyre!(e))? { - return Err(eyre!("Found existing plan in `/nix/receipt.json` which used different planner settings, try uninstalling the existing install")) + return Err(eyre!("Found existing plan in `{RECEIPT_LOCATION}` which used different planner settings, try uninstalling the existing install")) } if existing_receipt.actions.iter().all(|v| v.action_state() == ActionState::Completed) { - return Err(eyre!("Found existing plan in `/nix/receipt.json`, with the same settings, already completed, try uninstalling and reinstalling if Nix isn't working")) + return Err(eyre!("Found existing plan in `{RECEIPT_LOCATION}`, with the same settings, already completed, try uninstalling and reinstalling if Nix isn't working")) } existing_receipt } , From a7ab480eea78938b0e93c3b7fa3298c59e014ad3 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 9 Nov 2022 09:25:29 -0800 Subject: [PATCH 17/22] Get repeated install working in CI --- .github/workflows/ci.yml | 8 ++++++++ src/action/common/configure_nix_daemon_service.rs | 13 +++++++++++-- src/action/linux/start_systemd_unit.rs | 10 +++++++--- src/planner/linux/multi.rs | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adb6c1d..0843edf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,6 +101,10 @@ jobs: run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm - name: Repeated install run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --no-confirm + - name: Repeated test run + run: | + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix run nixpkgs#fortune - name: Repeated uninstall run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm @@ -140,6 +144,10 @@ jobs: run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm - name: Repeated install run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm + - name: Repeated test run + run: | + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix run nixpkgs#fortune - name: Repeated uninstall run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm \ No newline at end of file diff --git a/src/action/common/configure_nix_daemon_service.rs b/src/action/common/configure_nix_daemon_service.rs index 5e810fd..8f20d8e 100644 --- a/src/action/common/configure_nix_daemon_service.rs +++ b/src/action/common/configure_nix_daemon_service.rs @@ -132,6 +132,15 @@ impl Action for ConfigureNixDaemonService { execute_command(Command::new("systemctl").arg("daemon-reload")) .await .map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?; + + execute_command( + Command::new("systemctl") + .arg("enable") + .arg("--now") + .arg("nix-daemon.socket"), + ) + .await + .map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?; }, }; @@ -181,11 +190,11 @@ impl Action for ConfigureNixDaemonService { .map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?; }, _ => { - execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC])) + execute_command(Command::new("systemctl").args(["disable", SOCKET_SRC, "--now"])) .await .map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?; - execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC])) + execute_command(Command::new("systemctl").args(["disable", SERVICE_SRC, "--now"])) .await .map_err(|e| ConfigureNixDaemonServiceError::Command(e).boxed())?; diff --git a/src/action/linux/start_systemd_unit.rs b/src/action/linux/start_systemd_unit.rs index 7f36f57..5a21f77 100644 --- a/src/action/linux/start_systemd_unit.rs +++ b/src/action/linux/start_systemd_unit.rs @@ -90,9 +90,13 @@ impl Action for StartSystemdUnit { tracing::debug!("Stopping systemd unit"); // TODO(@Hoverbear): Handle proxy vars - execute_command(Command::new("systemctl").arg("stop").arg(format!("{unit}"))) - .await - .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; + execute_command( + Command::new("systemctl") + .arg("disable") + .arg(format!("{unit}")), + ) + .await + .map_err(|e| StartSystemdUnitError::Command(e).boxed())?; tracing::trace!("Stopped systemd unit"); *action_state = ActionState::Completed; diff --git a/src/planner/linux/multi.rs b/src/planner/linux/multi.rs index 54aa3aa..8c2657d 100644 --- a/src/planner/linux/multi.rs +++ b/src/planner/linux/multi.rs @@ -31,7 +31,7 @@ impl Planner for LinuxMulti { Box::new(CreateDirectory::plan("/nix", None, None, 0o0755, true).await?), Box::new(ProvisionNix::plan(self.settings.clone()).await?), Box::new(ConfigureNix::plan(self.settings).await?), - Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?), + // Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?), ], }) } From f2bf7f4073068656d18633a1d7e7a252a2ab67ee Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 9 Nov 2022 09:33:19 -0800 Subject: [PATCH 18/22] Set executable on mac too --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0843edf..a016630 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,6 +134,8 @@ jobs: - uses: actions/download-artifact@v3 with: name: harmonic-x86_64-darwin + - name: Set executable + run: chmod +x ./harmonic - name: Initial install run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --no-confirm - name: Test run From 9fa8d0e9486668d345e2114ad87936c2d468e1b5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 9 Nov 2022 10:13:49 -0800 Subject: [PATCH 19/22] Remove dead code --- src/planner/linux/multi.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/planner/linux/multi.rs b/src/planner/linux/multi.rs index 8c2657d..a32d3c8 100644 --- a/src/planner/linux/multi.rs +++ b/src/planner/linux/multi.rs @@ -31,7 +31,6 @@ impl Planner for LinuxMulti { Box::new(CreateDirectory::plan("/nix", None, None, 0o0755, true).await?), Box::new(ProvisionNix::plan(self.settings.clone()).await?), Box::new(ConfigureNix::plan(self.settings).await?), - // Box::new(StartSystemdUnit::plan("nix-daemon.socket".into()).await?), ], }) } From 706ecccaa300e5ec62be01930447ad76b9d48592 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Wed, 2 Nov 2022 13:12:13 +0000 Subject: [PATCH 20/22] Fix flake.nix descriptor --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 379df8b..3672b02 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "riff"; + description = "harmonic"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; From e98827d5aee7586aef1b105b48375695b5a37806 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Thu, 10 Nov 2022 15:54:12 +0100 Subject: [PATCH 21/22] Restructure common actions into common and base Base actions are those that don't depend on another action to execute. They mostly map to "very simple" OS operations like creating a directory or user. Base actions MUST be multi-platform compatible. Common actions may then use any set of base actions or other common actions. Base actions MUST NOT depend on other base actions. --- .../configure_nix_daemon_service.rs | 0 .../{common => base}/create_directory.rs | 0 src/action/{common => base}/create_file.rs | 0 src/action/{common => base}/create_group.rs | 0 .../{common => base}/create_or_append_file.rs | 0 src/action/{common => base}/create_user.rs | 0 src/action/{common => base}/fetch_nix.rs | 0 src/action/base/mod.rs | 22 +++++++++++++++++++ .../{common => base}/move_unpacked_nix.rs | 0 .../{common => base}/setup_default_profile.rs | 0 src/action/common/configure_nix.rs | 10 ++++----- src/action/common/configure_shell_profile.rs | 11 ++++------ src/action/common/create_nix_tree.rs | 2 +- src/action/common/create_users_and_group.rs | 6 ++--- src/action/common/mod.rs | 20 +---------------- .../common/place_channel_configuration.rs | 6 ++--- src/action/common/place_nix_configuration.rs | 3 +-- src/action/common/provision_nix.rs | 9 +++----- src/action/darwin/create_apfs_volume.rs | 13 +++++------ src/action/linux/create_systemd_sysext.rs | 5 ++--- src/action/linux/systemd_sysext_merge.rs | 7 ++---- src/action/mod.rs | 1 + src/planner/linux/multi.rs | 7 +++--- src/planner/specific/steam_deck.rs | 3 ++- 24 files changed, 56 insertions(+), 69 deletions(-) rename src/action/{common => base}/configure_nix_daemon_service.rs (100%) rename src/action/{common => base}/create_directory.rs (100%) rename src/action/{common => base}/create_file.rs (100%) rename src/action/{common => base}/create_group.rs (100%) rename src/action/{common => base}/create_or_append_file.rs (100%) rename src/action/{common => base}/create_user.rs (100%) rename src/action/{common => base}/fetch_nix.rs (100%) create mode 100644 src/action/base/mod.rs rename src/action/{common => base}/move_unpacked_nix.rs (100%) rename src/action/{common => base}/setup_default_profile.rs (100%) diff --git a/src/action/common/configure_nix_daemon_service.rs b/src/action/base/configure_nix_daemon_service.rs similarity index 100% rename from src/action/common/configure_nix_daemon_service.rs rename to src/action/base/configure_nix_daemon_service.rs diff --git a/src/action/common/create_directory.rs b/src/action/base/create_directory.rs similarity index 100% rename from src/action/common/create_directory.rs rename to src/action/base/create_directory.rs diff --git a/src/action/common/create_file.rs b/src/action/base/create_file.rs similarity index 100% rename from src/action/common/create_file.rs rename to src/action/base/create_file.rs diff --git a/src/action/common/create_group.rs b/src/action/base/create_group.rs similarity index 100% rename from src/action/common/create_group.rs rename to src/action/base/create_group.rs diff --git a/src/action/common/create_or_append_file.rs b/src/action/base/create_or_append_file.rs similarity index 100% rename from src/action/common/create_or_append_file.rs rename to src/action/base/create_or_append_file.rs diff --git a/src/action/common/create_user.rs b/src/action/base/create_user.rs similarity index 100% rename from src/action/common/create_user.rs rename to src/action/base/create_user.rs diff --git a/src/action/common/fetch_nix.rs b/src/action/base/fetch_nix.rs similarity index 100% rename from src/action/common/fetch_nix.rs rename to src/action/base/fetch_nix.rs diff --git a/src/action/base/mod.rs b/src/action/base/mod.rs new file mode 100644 index 0000000..d6830a8 --- /dev/null +++ b/src/action/base/mod.rs @@ -0,0 +1,22 @@ +//! Base actions that themselves have no other actions as dependencies + +mod configure_nix_daemon_service; +mod create_directory; +mod create_file; +mod create_group; +mod create_or_append_file; +mod create_user; +mod fetch_nix; +mod move_unpacked_nix; +mod setup_default_profile; + +pub use configure_nix_daemon_service::{ConfigureNixDaemonService, ConfigureNixDaemonServiceError}; +pub use create_directory::{CreateDirectory, CreateDirectoryError}; +pub use create_file::{CreateFile, CreateFileError}; +pub use create_group::{CreateGroup, CreateGroupError}; +pub use create_or_append_file::{CreateOrAppendFile, CreateOrAppendFileError}; +pub use create_user::{CreateUser, CreateUserError}; +pub use fetch_nix::{FetchNix, FetchNixError}; +pub use move_unpacked_nix::{MoveUnpackedNix, MoveUnpackedNixError}; +pub use setup_default_profile::{SetupDefaultProfile, SetupDefaultProfileError}; + diff --git a/src/action/common/move_unpacked_nix.rs b/src/action/base/move_unpacked_nix.rs similarity index 100% rename from src/action/common/move_unpacked_nix.rs rename to src/action/base/move_unpacked_nix.rs diff --git a/src/action/common/setup_default_profile.rs b/src/action/base/setup_default_profile.rs similarity index 100% rename from src/action/common/setup_default_profile.rs rename to src/action/base/setup_default_profile.rs diff --git a/src/action/common/configure_nix.rs b/src/action/common/configure_nix.rs index 214cdc1..ac2c561 100644 --- a/src/action/common/configure_nix.rs +++ b/src/action/common/configure_nix.rs @@ -1,17 +1,15 @@ -use reqwest::Url; - use crate::{ action::{ - common::{ - ConfigureNixDaemonService, ConfigureShellProfile, PlaceChannelConfiguration, - PlaceNixConfiguration, SetupDefaultProfile, - }, + base::{ConfigureNixDaemonService, SetupDefaultProfile}, + common::{ConfigureShellProfile, PlaceChannelConfiguration, PlaceNixConfiguration}, Action, ActionDescription, ActionState, }, channel_value::ChannelValue, BoxableError, CommonSettings, }; +use reqwest::Url; + #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct ConfigureNix { setup_default_profile: SetupDefaultProfile, diff --git a/src/action/common/configure_shell_profile.rs b/src/action/common/configure_shell_profile.rs index 8a903da..b5b434d 100644 --- a/src/action/common/configure_shell_profile.rs +++ b/src/action/common/configure_shell_profile.rs @@ -1,13 +1,10 @@ +use crate::action::base::{CreateOrAppendFile, CreateOrAppendFileError}; +use crate::action::{Action, ActionDescription, ActionState}; +use crate::BoxableError; + use std::path::Path; - use tokio::task::{JoinError, JoinSet}; -use crate::action::common::{CreateOrAppendFile, CreateOrAppendFileError}; -use crate::{ - action::{Action, ActionDescription, ActionState}, - BoxableError, -}; - const PROFILE_TARGETS: &[&str] = &[ "/etc/bashrc", "/etc/profile.d/nix.sh", diff --git a/src/action/common/create_nix_tree.rs b/src/action/common/create_nix_tree.rs index c96e00e..3ebe209 100644 --- a/src/action/common/create_nix_tree.rs +++ b/src/action/common/create_nix_tree.rs @@ -1,4 +1,4 @@ -use crate::action::common::{CreateDirectory, CreateDirectoryError}; +use crate::action::base::{CreateDirectory, CreateDirectoryError}; use crate::action::{Action, ActionDescription, ActionState}; const PATHS: &[&str] = &[ diff --git a/src/action/common/create_users_and_group.rs b/src/action/common/create_users_and_group.rs index 619eb3c..a4fea57 100644 --- a/src/action/common/create_users_and_group.rs +++ b/src/action/common/create_users_and_group.rs @@ -1,14 +1,12 @@ -use tokio::task::{JoinError, JoinSet}; - use crate::CommonSettings; - use crate::{ action::{ - common::{CreateGroup, CreateGroupError, CreateUser, CreateUserError}, + base::{CreateGroup, CreateGroupError, CreateUser, CreateUserError}, Action, ActionDescription, ActionState, }, BoxableError, }; +use tokio::task::{JoinError, JoinSet}; #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct CreateUsersAndGroup { diff --git a/src/action/common/mod.rs b/src/action/common/mod.rs index ce9520a..82aa6b3 100644 --- a/src/action/common/mod.rs +++ b/src/action/common/mod.rs @@ -1,35 +1,17 @@ /*! Actions which only call other base plugins. */ mod configure_nix; -mod configure_nix_daemon_service; -mod configure_shell_profile; -mod create_directory; -mod create_file; -mod create_group; mod create_nix_tree; -mod create_or_append_file; -mod create_user; +mod configure_shell_profile; mod create_users_and_group; -mod fetch_nix; -mod move_unpacked_nix; mod place_channel_configuration; mod place_nix_configuration; mod provision_nix; -mod setup_default_profile; pub use configure_nix::ConfigureNix; -pub use configure_nix_daemon_service::{ConfigureNixDaemonService, ConfigureNixDaemonServiceError}; pub use configure_shell_profile::ConfigureShellProfile; -pub use create_directory::{CreateDirectory, CreateDirectoryError}; -pub use create_file::{CreateFile, CreateFileError}; -pub use create_group::{CreateGroup, CreateGroupError}; pub use create_nix_tree::{CreateNixTree, CreateNixTreeError}; -pub use create_or_append_file::{CreateOrAppendFile, CreateOrAppendFileError}; -pub use create_user::{CreateUser, CreateUserError}; pub use create_users_and_group::{CreateUsersAndGroup, CreateUsersAndGroupError}; -pub use fetch_nix::{FetchNix, FetchNixError}; -pub use move_unpacked_nix::{MoveUnpackedNix, MoveUnpackedNixError}; pub use place_channel_configuration::{PlaceChannelConfiguration, PlaceChannelConfigurationError}; pub use place_nix_configuration::{PlaceNixConfiguration, PlaceNixConfigurationError}; pub use provision_nix::{ProvisionNix, ProvisionNixError}; -pub use setup_default_profile::{SetupDefaultProfile, SetupDefaultProfileError}; diff --git a/src/action/common/place_channel_configuration.rs b/src/action/common/place_channel_configuration.rs index a44a5ac..d8eba90 100644 --- a/src/action/common/place_channel_configuration.rs +++ b/src/action/common/place_channel_configuration.rs @@ -1,11 +1,9 @@ -use reqwest::Url; - +use crate::action::base::{CreateFile, CreateFileError}; use crate::{ action::{Action, ActionDescription, ActionState}, BoxableError, }; - -use crate::action::common::{CreateFile, CreateFileError}; +use reqwest::Url; #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct PlaceChannelConfiguration { diff --git a/src/action/common/place_nix_configuration.rs b/src/action/common/place_nix_configuration.rs index 9aa444a..e2240f6 100644 --- a/src/action/common/place_nix_configuration.rs +++ b/src/action/common/place_nix_configuration.rs @@ -1,7 +1,6 @@ +use crate::action::base::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; use crate::action::{Action, ActionDescription, ActionState}; -use crate::action::common::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; - const NIX_CONF_FOLDER: &str = "/etc/nix"; const NIX_CONF: &str = "/etc/nix/nix.conf"; diff --git a/src/action/common/provision_nix.rs b/src/action/common/provision_nix.rs index 937e74d..10fbbae 100644 --- a/src/action/common/provision_nix.rs +++ b/src/action/common/provision_nix.rs @@ -1,16 +1,13 @@ -use std::path::PathBuf; - -use tokio::task::JoinError; - -use crate::action::common::{ +use crate::action::base::{ CreateDirectoryError, FetchNix, FetchNixError, MoveUnpackedNix, MoveUnpackedNixError, }; use crate::CommonSettings; - use crate::{ action::{Action, ActionDescription, ActionState}, BoxableError, }; +use std::path::PathBuf; +use tokio::task::JoinError; use super::{CreateNixTree, CreateNixTreeError, CreateUsersAndGroup, CreateUsersAndGroupError}; diff --git a/src/action/darwin/create_apfs_volume.rs b/src/action/darwin/create_apfs_volume.rs index c6a8cf5..6e886ab 100644 --- a/src/action/darwin/create_apfs_volume.rs +++ b/src/action/darwin/create_apfs_volume.rs @@ -1,12 +1,6 @@ -use std::{ - path::{Path, PathBuf}, - time::Duration, -}; -use tokio::process::Command; - use crate::{ action::{ - common::{CreateFile, CreateFileError, CreateOrAppendFile, CreateOrAppendFileError}, + base::{CreateFile, CreateFileError, CreateOrAppendFile, CreateOrAppendFileError}, darwin::{ BootstrapVolume, BootstrapVolumeError, CreateSyntheticObjects, CreateSyntheticObjectsError, CreateVolume, CreateVolumeError, EnableOwnership, @@ -17,6 +11,11 @@ use crate::{ }, BoxableError, }; +use std::{ + path::{Path, PathBuf}, + time::Duration, +}; +use tokio::process::Command; const NIX_VOLUME_MOUNTD_DEST: &str = "/Library/LaunchDaemons/org.nixos.darwin-store.plist"; diff --git a/src/action/linux/create_systemd_sysext.rs b/src/action/linux/create_systemd_sysext.rs index c9dde74..b4029a7 100644 --- a/src/action/linux/create_systemd_sysext.rs +++ b/src/action/linux/create_systemd_sysext.rs @@ -1,10 +1,9 @@ -use std::path::{Path, PathBuf}; - -use crate::action::common::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; +use crate::action::base::{CreateDirectory, CreateDirectoryError, CreateFile, CreateFileError}; use crate::{ action::{Action, ActionDescription, ActionState}, BoxableError, }; +use std::path::{Path, PathBuf}; const PATHS: &[&str] = &[ "usr", diff --git a/src/action/linux/systemd_sysext_merge.rs b/src/action/linux/systemd_sysext_merge.rs index 9d74d72..e021c2f 100644 --- a/src/action/linux/systemd_sysext_merge.rs +++ b/src/action/linux/systemd_sysext_merge.rs @@ -1,13 +1,10 @@ -use std::path::PathBuf; - -use tokio::process::Command; - use crate::execute_command; - use crate::{ action::{Action, ActionDescription, ActionState}, BoxableError, }; +use std::path::PathBuf; +use tokio::process::Command; #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct SystemdSysextMerge { diff --git a/src/action/mod.rs b/src/action/mod.rs index 99ef567..62b3751 100644 --- a/src/action/mod.rs +++ b/src/action/mod.rs @@ -1,3 +1,4 @@ +pub mod base; pub mod common; pub mod darwin; pub mod linux; diff --git a/src/planner/linux/multi.rs b/src/planner/linux/multi.rs index a191dd2..bcf3e67 100644 --- a/src/planner/linux/multi.rs +++ b/src/planner/linux/multi.rs @@ -1,13 +1,12 @@ -use std::collections::HashMap; - use crate::{ action::{ - common::{ConfigureNix, CreateDirectory, ProvisionNix}, - linux::StartSystemdUnit, + base::CreateDirectory, + common::{ConfigureNix, ProvisionNix}, }, planner::Planner, BuiltinPlanner, CommonSettings, InstallPlan, }; +use std::collections::HashMap; #[derive(Debug, Clone, clap::Parser, serde::Serialize, serde::Deserialize)] pub struct LinuxMulti { diff --git a/src/planner/specific/steam_deck.rs b/src/planner/specific/steam_deck.rs index 9ad73a0..628f6e0 100644 --- a/src/planner/specific/steam_deck.rs +++ b/src/planner/specific/steam_deck.rs @@ -2,7 +2,8 @@ use std::collections::HashMap; use crate::{ action::{ - common::{CreateDirectory, ProvisionNix}, + base::CreateDirectory, + common::ProvisionNix, linux::{CreateSystemdSysext, StartSystemdUnit}, }, planner::Planner, From 24a38ff454d66d7e7c98a98cf2dcc72b1b412a21 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Thu, 10 Nov 2022 16:08:47 +0100 Subject: [PATCH 22/22] cargo fmt --- src/action/base/mod.rs | 1 - src/action/common/mod.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/action/base/mod.rs b/src/action/base/mod.rs index d6830a8..f956868 100644 --- a/src/action/base/mod.rs +++ b/src/action/base/mod.rs @@ -19,4 +19,3 @@ pub use create_user::{CreateUser, CreateUserError}; pub use fetch_nix::{FetchNix, FetchNixError}; pub use move_unpacked_nix::{MoveUnpackedNix, MoveUnpackedNixError}; pub use setup_default_profile::{SetupDefaultProfile, SetupDefaultProfileError}; - diff --git a/src/action/common/mod.rs b/src/action/common/mod.rs index 82aa6b3..baa2d29 100644 --- a/src/action/common/mod.rs +++ b/src/action/common/mod.rs @@ -1,8 +1,8 @@ /*! Actions which only call other base plugins. */ mod configure_nix; -mod create_nix_tree; mod configure_shell_profile; +mod create_nix_tree; mod create_users_and_group; mod place_channel_configuration; mod place_nix_configuration;