aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authornotgne22020-10-10 10:31:55 -0700
committernotgne22020-10-10 10:31:55 -0700
commitdb8301a45796cd919cbfa085f85ac6288e73a8db (patch)
tree638d3554b03e50558c63432ee22fe3628d44b592 /src/utils
parent3a92593bf9c4ca07a2b09888e4a3f7dff6c9c510 (diff)
Add profile path option to profiles
Diffstat (limited to '')
-rw-r--r--src/utils/data.rs2
-rw-r--r--src/utils/mod.rs18
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 {