Skip to content

Commit

Permalink
Persist files added to /etc past system updates in SteamOS 3.6+ (#1355)
Browse files Browse the repository at this point in the history
* Add atomic update persistence list for SteamOS 3.6+

* Apply suggestions from code review and fix pushing the actual list

Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>

* fixup: create atomic-update.conf.d entry only if directory exists

* fixup: typo in variable name

steamos, not streamos lol

* fixup: path in test fixture

---------

Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>
  • Loading branch information
5310 and cole-h authored Dec 16, 2024
1 parent 6beefac commit 0ba8809
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/planner/steam_deck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ impl Planner for SteamDeck {
.map_err(PlannerError::Action)?;
actions.push(create_bind_mount_unit.boxed());
} else {
let revert_clean_streamos_nix_offload = RevertCleanSteamosNixOffload::plan()
let revert_clean_steamos_nix_offload = RevertCleanSteamosNixOffload::plan()
.await
.map_err(PlannerError::Action)?;
actions.push(revert_clean_streamos_nix_offload.boxed());
actions.push(revert_clean_steamos_nix_offload.boxed());

let ensure_steamos_nix_directory = EnsureSteamosNixDirectory::plan()
.await
Expand All @@ -270,6 +270,27 @@ impl Planner for SteamDeck {
actions.push(start_nix_mount.boxed());
}

if std::path::Path::new("/etc/atomic-update.conf.d").exists() {
let create_atomic_update_buf = "\
/etc/fish/conf.d/nix.fish\n\
/etc/nix/**\n\
/etc/profile.d/nix.sh\n\
/etc/systemd/system/nix-daemon.socket\n\
/etc/tmpfiles.d/nix-daemon.conf\n\
";
let create_atomic_update_unit = CreateFile::plan(
"/etc/atomic-update.conf.d/nix-installer.conf",
None,
None,
0o0644,
create_atomic_update_buf.to_string(),
false,
)
.await
.map_err(PlannerError::Action)?;
actions.push(create_atomic_update_unit.boxed());
}

let ensure_symlinked_units_resolve_buf = "\
[Unit]\n\
Description=Ensure Nix related units which are symlinked resolve\n\
Expand Down
12 changes: 12 additions & 0 deletions tests/fixtures/linux/steam-deck.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
},
"state": "Completed"
},
{
"action": {
"action_name": "create_file",
"path": "/etc/atomic-update.conf.d/nix-installer.conf",
"user": null,
"group": null,
"mode": 420,
"buf": "/etc/fish/conf.d/nix.fish\n/etc/nix/**\n/etc/profile.d/nix.sh\n/etc/systemd/system/nix-daemon.socket\n/etc/tmpfiles.d/nix-daemon.conf\n",
"force": false
},
"state": "Completed"
},
{
"action": {
"action_name": "start_systemd_unit",
Expand Down

0 comments on commit 0ba8809

Please sign in to comment.