From ae10e313652b6c10812ac7f93c5e0e18dcf0684a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 1 Feb 2026 22:02:59 -0500 Subject: [PATCH] Clean up steam deck config. --- nix/steam_deck/configuration/README.org | 79 +++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 nix/steam_deck/configuration/README.org diff --git a/nix/steam_deck/configuration/README.org b/nix/steam_deck/configuration/README.org new file mode 100644 index 00000000..6e324621 --- /dev/null +++ b/nix/steam_deck/configuration/README.org @@ -0,0 +1,79 @@ +* Initial Setup +** Mount /home/deck/nix to /nix +The default /nix is too small and it could be modified by OS releases. We want to use something in our home folder since that will be untouched in upgrades. + +# TODO: /home/nix gets owned by root but it should be owned by deck:deck for single-user nix installs + +# TODO: nixos-installer adds this to /home/deck/.bash_profile , will this be wiped out in updates? +# if [ -e /home/deck/.nix-profile/etc/profile.d/nix.sh ]; then . /home/deck/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer + +Create =/etc/systemd/system/nix-directory.service= +#+begin_src text + [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 +#+end_src + +Create =/etc/systemd/system/nix.mount= +#+begin_src text + [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 +#+end_src + +Create =/etc/systemd/system/ensure-symlinked-units-resolve.service= +#+begin_src text + [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 +#+end_src + +Enable the mount by running +#+begin_src bash + sudo systemctl enable --now ensure-symlinked-units-resolve.service +#+end_src +** Install nix +#+begin_src bash + sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --no-daemon +#+end_src