-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SteamOS Nix Offload in SteamOS 20230522.1000 #495
Support for SteamOS Nix Offload in SteamOS 20230522.1000 #495
Conversation
So I took a After rebooting into the new build, I confirmed that Nix still works. (deck@steamdeck ~)$ nix run nixpkgs#hello
Hello, world!
(deck@steamdeck ~)$ systemctl status nix-daemon.service
● nix-daemon.service - Nix Daemon
Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; preset: disabled)
Active: active (running) since Tue 2023-05-30 10:11:08 PDT; 4min 16s ago
TriggeredBy: ● nix-daemon.socket
Docs: man:nix-daemon
https://nixos.org/manual
Main PID: 4487 (nix-daemon)
Tasks: 2 (limit: 9395)
Memory: 6.9M
CPU: 55ms
CGroup: /system.slice/nix-daemon.service
└─4487 nix-daemon --daemon
May 30 10:11:08 steamdeck systemd[1]: Started Nix Daemon.
May 30 10:11:08 steamdeck nix-daemon[4487]: accepted connection from pid 4484, user deck
May 30 10:15:17 steamdeck nix-daemon[4487]: accepted connection from pid 4564, user deck
(deck@steamdeck ~)$ systemctl status nix-directory.service
● nix-directory.service - Create a `/nix` directory to be used for bind mounting
Loaded: loaded (/etc/systemd/system/nix-directory.service; static)
Active: active (exited) since Tue 2023-05-30 10:09:32 PDT; 5min ago
Main PID: 886 (code=exited, status=0/SUCCESS)
CPU: 41ms
May 30 10:09:32 steamdeck systemd[1]: Starting Create a `/nix` directory to be used for bind mounting...
May 30 10:09:32 steamdeck chmod[879]: mode of '/nix' retained as 0755 (rwxr-xr-x)
May 30 10:09:32 steamdeck chown[883]: ownership of '/nix' retained as root
May 30 10:09:32 steamdeck chgrp[884]: group of '/nix' retained as root
May 30 10:09:32 steamdeck systemd[1]: Finished Create a `/nix` directory to be used for bind mounting.
(deck@steamdeck ~)$ systemctl status nix.mount
● nix.mount - Mount `/home/nix` on `/nix`
Loaded: loaded (/proc/self/mountinfo; disabled; preset: disabled)
Active: active (mounted) since Tue 2023-05-30 10:09:32 PDT; 6min ago
Until: Tue 2023-05-30 10:09:32 PDT; 6min ago
Where: /nix
What: /dev/vda8
Tasks: 0 (limit: 9395)
Memory: 4.0K
CPU: 1ms
CGroup: /system.slice/nix.mount
May 30 10:09:32 steamdeck systemd[1]: Mounting Mount `/home/nix` on `/nix`...
May 30 10:09:32 steamdeck systemd[1]: Mounted Mount `/home/nix` on `/nix`.
(deck@steamdeck ~)$ cat /etc/os-release
NAME="SteamOS"
PRETTY_NAME="SteamOS"
VERSION_CODENAME=holo
ID=steamos
ID_LIKE=arch
ANSI_COLOR="1;35"
HOME_URL="https://www.steampowered.com/"
DOCUMENTATION_URL="https://support.steampowered.com/"
SUPPORT_URL="https://support.steampowered.com/"
BUG_REPORT_URL="https://support.steampowered.com/"
LOGO=steamos
VARIANT_ID=steamdeck
BUILD_ID=20230522.1000
VERSION_ID=3.5 It uninstalled cleanly:
However it seems we aren't reloading systemd on uninstall. Checking (130)(deck@steamdeck ~)$ systemctl status nix.mount
Warning: The unit file, source configuration file or drop-ins of nix.mount changed on disk. Run 'systemctl daemon-reload' to reload units.
○ nix.mount - Mount `/home/nix` on `/nix`
Loaded: loaded (/proc/self/mountinfo; disabled; preset: disabled)
Active: inactive (dead) since Tue 2023-05-30 10:17:02 PDT; 55s ago
Duration: 7min 29.668s
Where: /nix
What: /home/nix
CPU: 3ms
May 30 10:09:32 steamdeck systemd[1]: Mounting Mount `/home/nix` on `/nix`...
May 30 10:09:32 steamdeck systemd[1]: Mounted Mount `/home/nix` on `/nix`.
May 30 10:17:02 steamdeck systemd[1]: Unmounting Mount `/home/nix` on `/nix`...
May 30 10:17:02 steamdeck systemd[1]: nix.mount: Deactivated successfully.
May 30 10:17:02 steamdeck systemd[1]: Unmounted Mount `/home/nix` on `/nix`. I thought we did this: nix-installer/src/action/common/configure_init_service.rs Lines 534 to 543 in 457127b
... It seems the timing is wrong though. We need it to happen at the very end of the install. Dang. Anyways, reloading: (deck@steamdeck ~)$ systemctl daemon-reload
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ====
Authentication is required to reload the systemd state.
Authenticating as: Steam Deck User (deck)
Password:
==== AUTHENTICATION COMPLETE ====
(deck@steamdeck ~)$ systemctl status nix.mount
○ nix.mount - SteamOS Offload - /nix
Loaded: loaded (/usr/lib/systemd/system/nix.mount; disabled; preset: disabled)
Active: inactive (dead) since Tue 2023-05-30 10:17:02 PDT; 2min 9s ago
Duration: 7min 29.668s
Where: /nix
What: /home/.steamos/offload/nix
CPU: 3ms
May 30 10:09:32 steamdeck systemd[1]: Mounting Mount `/home/nix` on `/nix`...
May 30 10:09:32 steamdeck systemd[1]: Mounted Mount `/home/nix` on `/nix`.
May 30 10:17:02 steamdeck systemd[1]: Unmounting Mount `/home/nix` on `/nix`...
May 30 10:17:02 steamdeck systemd[1]: nix.mount: Deactivated successfully.
May 30 10:17:02 steamdeck systemd[1]: Unmounted Mount `/home/nix` on `/nix`. When I try to reinstall I can see the planner isn't quite picking up that we can use that offload. That's because
Rebooting, we can see that the
We can remedy this: (deck@steamdeck ~)$ sudo steamos-readonly disable
(deck@steamdeck ~)$ sudo mkdir -p /nix
(deck@steamdeck ~)$ sudo steamos-readonly enable Then reboot, and install, getting the right plan: (deck@steamdeck ~)$ ./nix-installer install steam-deck
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] password for deck:
Nix install plan (v0.9.1-unreleased)
Planner: steam-deck (with default settings)
Planned actions:
* Create or overwrite file `/etc/systemd/system/ensure-symlinked-units-resolve.service`
* Fetch `https://releases.nixos.org/nix/nix-2.15.0/nix-2.15.0-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create group `nixbld` (GID 30000)
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Enable (and start) the systemd unit ensure-symlinked-units-resolve.service
* Remove directory `/nix/temp-install-dir`
Proceed? ([Y]es/[n]o/[e]xplain): |
So that if you install nix, then upgrade SteamOS, then uninstall nix, you end up roughly here:
Because we aren't running After #495 we'll actually notify you are in this state: (deck@steamdeck ~)$ ./nix-installer install steam-deck
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] password for deck:
Error:
0: Planner error
1: Custom planner error
2: Detected the SteamOS `nix.mount` unit exists, but `systemctl status nix.mount` returned a warning that `systemctl daemon-reload` should be run. Run `systemctl daemon-reload` and try again.
Location:
src/cli/subcommand/install.rs:117
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets. After you do that (or say, you uninstall then reboot) you'll see roughly this: (deck@steamdeck ~)$ systemctl status nix.mount
○ nix.mount - SteamOS Offload - /nix
Loaded: loaded (/usr/lib/systemd/system/nix.mount; enabled; preset: disabled)
Active: inactive (dead) since Wed 2023-05-31 12:04:25 PDT; 56min ago
Duration: 1min 53.950s
Condition: start condition failed at Wed 2023-05-31 12:49:07 PDT; 11min ago
└─ ConditionPathExists=/nix was not met
Where: /nix
What: /home/.steamos/offload/nix
CPU: 3ms
May 31 12:04:25 steamdeck systemd[1]: Unmounting Mount `/home/nix` on `/nix`...
May 31 12:04:25 steamdeck systemd[1]: nix.mount: Deactivated successfully.
May 31 12:04:25 steamdeck systemd[1]: Unmounted Mount `/home/nix` on `/nix`.
May 31 12:49:07 steamdeck systemd[1]: SteamOS Offload - /nix was skipped because of a failed condition check (ConditionPathExists=/nix).
(3)(deck@steamdeck ~)$ ./nix-installer install steam-deck
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] password for deck:
Nix install plan (v0.9.1-unreleased)
Planner: steam-deck (with default settings)
Planned actions:
* Run `systemctl daemon-reload`
* Ensure SteamOS's `/nix` directory exists
* Enable (and start) the systemd unit nix.mount
* Create or overwrite file `/etc/systemd/system/ensure-symlinked-units-resolve.service`
* Fetch `https://releases.nixos.org/nix/nix-2.15.0/nix-2.15.0-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create group `nixbld` (GID 30000)
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Enable (and start) the systemd unit ensure-symlinked-units-resolve.service
* Remove directory `/nix/temp-install-dir`
* Run `systemctl daemon-reload`
Proceed? ([Y]es/[n]o/[e]xplain): y
INFO Step: Run `systemctl daemon-reload`
INFO Step: Ensure SteamOS's `/nix` directory exists
INFO Step: Enable (and start) the systemd unit nix.mount
INFO Step: Create or overwrite file `/etc/systemd/system/ensure-symlinked-units-resolve.service`
INFO Step: Provision Nix
INFO Step: Configure Nix
INFO Step: Configure Nix daemon related settings with systemd
INFO Step: Enable (and start) the systemd unit ensure-symlinked-units-resolve.service
INFO Step: Remove directory `/nix/temp-install-dir`
INFO Step: Run `systemctl daemon-reload`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`
(deck@steamdeck ~)$ . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
(deck@steamdeck ~)$ nix run nixpkgs#hello
Hello, world!
(deck@steamdeck ~)$ systemctl status nix.mount
● nix.mount - SteamOS Offload - /nix
Loaded: loaded (/proc/self/mountinfo; enabled; preset: disabled)
Active: active (mounted) since Wed 2023-05-31 13:01:33 PDT; 45s ago
Until: Wed 2023-05-31 13:01:33 PDT; 45s ago
Where: /nix
What: /dev/vda8
Tasks: 0 (limit: 9395)
Memory: 8.0K
CPU: 1ms
CGroup: /system.slice/nix.mount
May 31 13:01:33 steamdeck systemd[1]: Mounting SteamOS Offload - /nix...
May 31 13:01:33 steamdeck systemd[1]: Mounted SteamOS Offload - /nix.
(deck@steamdeck ~)$ /nix/nix-installer uninstall
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix uninstall plan (v0.9.1-unreleased)
Planner: steam-deck (with default settings)
Planned actions:
* Run `systemctl daemon-reload`
* Disable (and stop) the systemd unit ensure-symlinked-units-resolve.service
* Unconfigure Nix daemon related settings with systemd
* Unconfigure the shell profiles
* Remove the Nix configuration in `/etc/nix/nix.conf`
* Unset the default Nix profile
* Remove the directory tree in `/nix`
* Delete group `nixbld` (GID 30000)
* Delete file `/etc/systemd/system/ensure-symlinked-units-resolve.service`
* Disable (and stop) the systemd unit nix.mount
* Run `systemctl daemon-reload`
Proceed? ([Y]es/[n]o/[e]xplain): y
INFO Revert: Run `systemctl daemon-reload`
INFO Revert: Remove directory `/nix/temp-install-dir`
INFO Revert: Enable (and start) the systemd unit ensure-symlinked-units-resolve.service
INFO Revert: Configure Nix daemon related settings with systemd
INFO Revert: Configure Nix
INFO Revert: Provision Nix
INFO Revert: Create or overwrite file `/etc/systemd/system/ensure-symlinked-units-resolve.service`
INFO Revert: Enable (and start) the systemd unit nix.mount
INFO Revert: Ensure SteamOS's `/nix` directory exists
INFO Revert: Run `systemctl daemon-reload`
Nix was uninstalled successfully! |
@cole-h I'd appreciate a second check of both the non-upgrade and upgrade path. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems OK? I don't have a Steam Deck, so I had to resort to testing in a VM, and it seems to have worked just fine? I installed on 20220425.2, updated to 20230522.1000, rebooted, and everything still worked. Uninstalled and reinstalled on 20230522.1000 and everything still worked.
I'm gonna give it a go on hardware and hit merge if it works. :) |
Confirmed working on real hardware! |
Shoot, I just noticed uninstalling on |
Description
Fixes #474
Before I undraft I need to figure out a good story for users who might have nix installed when they update to this version...
Checklist
cargo fmt
nix build
nix flake check
Validating with
install.determinate.systems
If a maintainer has added the
upload to s3
label to this PR, it will become available for installation viainstall.determinate.systems
: