80 lines
2.3 KiB
Org Mode
80 lines
2.3 KiB
Org Mode
* 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
|