NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.26k stars 1.48k forks source link

Steam Deck support #7173

Open Atemu opened 1 year ago

Atemu commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

It is currently not possible to install Nix on the Steam Deck using the regular installer due to its special immutable rootfs setup.

Valve has left us with quite some options however:

Describe the solution you'd like A clear and concise description of what you want to happen.

Ideally we could have Valve add an empty /nix/ directory to their SteamOS image. This way we could bind-mount a directory inside home onto /nix/ via a simple systemd mount unit and Nix could operate as usual.

IIRC we have tried to reach out to Apple regarding /nix on macOS before but that wasn't very fruitful (heh).
Going by their past behaviour, I imagine Valve might be much more cooperative on such matters.

Perhaps we could even reach out to them in an "official" manner via the NixOS foundation.
The Guix folks might also have an interest in joining our request with one for a /gnu/ directory.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

It is probably possible to achieve a rw /nix/ without the help of Valve using overlayfs, selectively mounting /usr/ etc. onto a custom tmpfs root or worse hacks but those might not even be possible or might be fragile.

Additional context Add any other context or screenshots about the feature request here.

The Steam Deck has limited possibilities in extending it with your own software due to its read-only rootfs. You can't just install Arch packages via pacman for instance.
Flatpak is installed and enabled by default and it covers GUI apps fairly well but it doesn't cover CLI apps at all.

Nix could really shine here.

theVakhovskeIsTaken commented 7 months ago

though note I'm having an issue where I need to start the daemon after each boot. 🤷‍♂️

That's side effects of mounting /etc as an overlay after systemd starts. If Valve mounts /etc overlay in initramfs stage, all of the "user-added" services theoretically could work fine

bertogg commented 5 months ago

If Valve mounts /etc overlay in initramfs stage, all of the "user-added" services theoretically could work fine

This is already happening. The /etc overlay is not the problem here and users can add their own systemd services just fine.

It's /nix that is only available later during the boot process, and that's where the service file is installed:

$ ls -l /etc/systemd/system/nix-daemon.service
lrwxrwxrwx 1 root root 67 Apr 16 14:08 /etc/systemd/system/nix-daemon.service -> /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.service

This is a known limitation: https://github.com/systemd/systemd/issues/8307

You will have the same problem in a regular distro where /nix is in a separate filesystem.

Possible solutions are: