Steam Deck as infrastructure control plane

Steam Deck setup as the initial control plane to spin up the humble project

Steam Deck story

I recently returned from a pleasant trip to Canada. My cousin gave me his Steam Deck since he was after the newest model, and I was looking for a Linux workstation to run as the initial control plane for my humble/homelab project.

Enable SSH

From the Steam Deck menu, switch to the Steam Desktop. Then open up the Konsole terminal.

The terminal should look like this:

(deck@steamdeck ~) $

deck is the default username. By default, there is no password set on the account, so you can simply run:

passwd

But my cousin had set one earlier, and luckily he still remembers it.

Then we can enable SSHD with sudo:

sudo systemctl start sshd

To start SSHD on every boot, enable it:

sudo systemctl enable sshd

Install Nix

I use nix-shell to install and run all the tools and packages I need for my homelab.

I followed the pretty good guide here.

If you don’t mind breaking things, their script is quite solid:

curl -L https://install.determinate.systems/nix | sh -s -- install steam-deck

I took the 4-step dance.

Create /etc/systemd/system/nix-directory.service:

[Unit]
Description=Create a `/nix` directory to be used for bind mounting
PropagatesStopTo=nix-daemon.service
PropagatesStopTo=nix.mount
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=steamos-readonly disable
ExecStart=mkdir -vp /nix
ExecStart=chmod -v 0755 /nix
ExecStart=chown -v root /nix
ExecStart=chgrp -v root /nix
ExecStart=steamos-readonly enable
ExecStop=steamos-readonly disable
ExecStop=rmdir /nix
ExecStop=steamos-readonly enable
RemainAfterExit=true

Then create /etc/systemd/system/nix.mount:

[Unit]
Description=Mount `/home/nix` on `/nix`
PropagatesStopTo=nix-daemon.service
PropagatesStopTo=nix-directory.service
After=nix-directory.service
Requires=nix-directory.service
ConditionPathIsDirectory=/nix
DefaultDependencies=no
RequiredBy=nix-daemon.service
RequiredBy=nix-daemon.socket
[Mount]
What=/home/nix
Where=/nix
Type=none
DirectoryMode=0755
Options=bind

And create /etc/systemd/system/ensure-symlinked-units-resolve.service:

[Unit]
Description=Ensure Nix related units which are symlinked resolve
After=nix.mount
Requires=nix-directory.service
Requires=nix.mount
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/systemctl daemon-reload
ExecStart=/usr/bin/systemctl restart --no-block nix-daemon.socket
[Install]
WantedBy=sysinit.target

Then enable the ensure-symlinked-units-resolve service, and it will start the chain of settings:

sudo systemctl enable --now ensure-symlinked-units-resolve.service

And run the installation script normally:

sh <(curl -L https://nixos.org/nix/install) --daemon

Install Arch Linux packages

I need docker to spin up the PXE servers. The setup is straightforward; I followed this guide here.

Since we disabled steamos-readonly after the Nix installation, I skipped this step:

sudo steamos-readonly disable

Initialize pacman’s keyring:

sudo pacman-key --init

Populate pacman’s keyring with the default Arch Linux keys:

sudo pacman-key --populate archlinux

Then install docker with pacman. I also noticed that some packages get uninstalled or reverted when running the upgrade via the Steam Deck settings menu. I guess that’s normal since we were messing with the internal packages.

Some tweaks

While starting PXE boot over IPv4, the process hung and the target servers couldn’t reach the PXE service.

Turned out firewalld was blocking them. So I added a few more ports for HTTP and DHCP:

sudo firewall-cmd --add-port=80/tcp
sudo firewall-cmd --add-port=67/udp

Result

I’m able to spin up the full homelab with a single command from the Steam Deck. Pretty cool, and pretty weird way of using a Steam Deck.