diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/data.rs | 2 | ||||
-rw-r--r-- | src/utils/mod.rs | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/utils/data.rs b/src/utils/data.rs index 371c82d..f72f9a7 100644 --- a/src/utils/data.rs +++ b/src/utils/data.rs @@ -42,6 +42,8 @@ pub struct NodeSettings { pub struct ProfileSettings { pub path: String, pub bootstrap: Option<String>, + #[serde(rename(deserialize = "profilePath"))] + pub profile_path: Option<String>, } #[derive(Deserialize, Debug, Clone)] diff --git a/src/utils/mod.rs b/src/utils/mod.rs index bfdbc5e..51f977f 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -129,7 +129,7 @@ pub struct DeployData<'a> { pub struct DeployDefs<'a> { pub ssh_user: Cow<'a, str>, pub profile_user: Cow<'a, str>, - pub profile_path: String, + pub profile_path: Cow<'a, str>, pub current_exe: PathBuf, pub sudo: Option<String>, } @@ -153,12 +153,16 @@ impl<'a> DeployData<'a> { }, }; - let profile_path = match &profile_user[..] { - "root" => format!("/nix/var/nix/profiles/{}", self.profile_name), - _ => format!( - "/nix/var/nix/profiles/per-user/{}/{}", - profile_user, self.profile_name - ), + let profile_path: Cow<str> = match self.profile.profile_settings.profile_path { + None => match &profile_user[..] { + "root" => format!("/nix/var/nix/profiles/{}", self.profile_name).into(), + _ => format!( + "/nix/var/nix/profiles/per-user/{}/{}", + profile_user, self.profile_name + ) + .into(), + }, + Some(ref x) => x.into(), }; let sudo: Option<String> = match self.merged_settings.user { |