The Steam Deck (and SteamOS) delivers a fantastic console-like experience on a Linux system. However, its immutable filesystem means that installing packages that persist across system upgrades isn’t straightforward. Fortunately, with a little Nix magic, you can work around that limitation.
Immutable systems offer many benefits—until you need to customize your filesystem by installing packages. While installing software isn’t difficult per se, SteamOS’s design means that most customizations are wiped during system upgrades. About a year ago, Valve added /nix
to the list of directories that remain intact during updates, and that’s where Nix stores all of its packages.
If you’re not familiar with Nix: it’s a package manager that uses declarative definitions for your software instead of commands like
apt install
ordnf install
. You simply list all your desired packages in a configuration file, and Nix takes care of installing them. Additionally, the handynix-shell
utility lets you spawn temporary shells with the packages you specify.
There are two primary ways to work with Nix comfortably: you can either run NixOS (which isn’t ideal on a Steam Deck) or use Home Manager.
Installing Nix
Switch to Desktop Mode and open Konsole for the following steps. First, install Nix itself using this command (see the official installation instructions):
sh <(curl -L https://nixos.org/nix/install)
9 Comments
metadat
I didn't realize you could install Nix on any Linux distro. It actually looks really straightforward:
https://forum.elivelinux.org/t/how-to-install-nix-packages-o…
I'm giving it a go now in the easily undoable single-user "no-daemon" mode.
Super excited how approachable this makes Nix, I've put this off for many years due to what turned out to be an incorrect assumption about the level of commitment!
talldayo
This is actually a bit of a match made in heaven for Nix. The Steam Deck runs Arch with immutable root, which means most of the AUR packages won't entirely work. So you need a package manager which respects immutable root, supports atomic upgrades with Arch and has a package selection similar to the AUR. There are a few options, but the best one really is Nix: https://repology.org/repositories/statistics/newest
Given that package management on the Deck is traditionally handled with Flatpak, Nix seems like a great alternative for power users with storage to spare.
colordrops
Would love if there was a Nix flake for setting up retro gaming. Last time I checked you had to install these complicated tools and set them up manually.
jquaint
Love using Nix for retro gaming setups. Its great to bundle drivers, emulators, etc.
https://nixos.wiki/wiki/RetroArch
https://nixos.wiki/wiki/Playstation2
craftkiller
This is great. Nix made compiling ship of harkinian (ocarina of time pc port), 2ship2harkinian (majora's mask pc port) and sm64ex (super mario 64 pc port) trivial on nixos but where I really want them is on my steam deck. Now I can.
bsimpson
> you can either run NixOS (which isn’t ideal on a Steam Deck)
I've actually been using NixOS on my Legion Go to give me the SteamOS experience while I wait for the official image from Valve [1].
I knew that Valve had whitelisted /nix, but seeing how the author explicitly loads Nix in Bash:
makes me wonder how it works in game mode. Say that someone uses Nix to install a game like YARG that's not in the Steam store [2]. That will install the game to /nix/store and write an alias to the user's desktop. /home/deck is not immutable, so you could add the desktop file as a non-Steam game, and everything will work as expected, right?
What are the boundaries between things that work everywhere, things that only work after you've loaded a bash profile (e.g. from a terminal), and things that only work in NixOS? What if a package wants to run at login? What if it uses its own systemd rules?
[1] https://github.com/Jovian-Experiments/Jovian-NixOS/
[2] https://news.ycombinator.com/item?id=42991513
486sx33
Not to be confused with *nix
(Meaning any Linux or Unix)
ilrwbwrkhv
I bought 20 Steam Decks recently to give to one of my teams. Will share this with them.
sweeter
Nix is great on the steam deck in so many ways. I use home manager just to install my general development environment, but at the same time there are some issues. like the sleep/suspend button will often cause the Nix Daemon socket to stop working, and you and you have to restart it, which can be kind of hard if you don't have access to SSH or whatever.