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