Skip to content

Commit e0eedfb

Browse files
authored
Merge pull request #543 from nix-community/faukah/push-pyroxlpqkvrt
{home,nixos}: trim contents of /etc/specialisation
2 parents 5a6aea5 + b77ed35 commit e0eedfb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/home.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl HomeRebuildArgs {
179179
tracing::warn!("spec_location path is not valid UTF-8");
180180
None
181181
},
182-
|s| std::fs::read_to_string(s).ok(),
182+
|s| std::fs::read_to_string(s).ok().map(|s| s.trim().to_owned()),
183183
);
184184

185185
let target_specialisation = if self.no_specialisation {

src/nixos.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,9 @@ impl OsRebuildArgs {
565565
&self,
566566
out_path: &Path,
567567
) -> Result<PathBuf> {
568-
let current_specialisation = std::fs::read_to_string(SPEC_LOCATION).ok();
568+
let current_specialisation = std::fs::read_to_string(SPEC_LOCATION)
569+
.ok()
570+
.map(|s| s.trim().to_owned());
569571

570572
let target_specialisation = if self.no_specialisation {
571573
None
@@ -701,7 +703,9 @@ impl OsRollbackArgs {
701703
profile_dir.join(format!("system-{}-link", target_generation.number));
702704

703705
// Handle specialisations
704-
let current_specialisation = fs::read_to_string(SPEC_LOCATION).ok();
706+
let current_specialisation = fs::read_to_string(SPEC_LOCATION)
707+
.ok()
708+
.map(|s| s.trim().to_owned());
705709

706710
let target_specialisation = if self.no_specialisation {
707711
None

0 commit comments

Comments
 (0)