init commit
This commit is contained in:
commit
8a667ce584
76
install_nix.sh
Executable file
76
install_nix.sh
Executable file
@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
{
|
||||
sudo cat << EOF
|
||||
[Unit]
|
||||
Description=Create a `/nix` directory to be used for bind mounting
|
||||
PropagatesStopTo=nix-daemon.service
|
||||
PropagatesStopTo=nix.mount
|
||||
DefaultDependencies=no
|
||||
After=grub-recordfail.service
|
||||
After=steamos-finish-oobe-migration.service
|
||||
|
||||
[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
|
||||
EOF
|
||||
} > /etc/systemd/system/nix-directory.service
|
||||
{
|
||||
sudo cat << EOF
|
||||
[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
|
||||
|
||||
[Mount]
|
||||
What=/home/nix
|
||||
Where=/nix
|
||||
Type=none
|
||||
DirectoryMode=0755
|
||||
Options=bind
|
||||
EOF
|
||||
} > /etc/systemd/system/nix.mount
|
||||
{
|
||||
sudo cat << EOF
|
||||
[Unit]
|
||||
Description=Ensure Nix related units which are symlinked resolve
|
||||
After=nix.mount
|
||||
Requires=nix-directory.service
|
||||
Requires=nix.mount
|
||||
PropagatesStopTo=nix-directory.service
|
||||
PropagatesStopTo=nix.mount
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/bin/systemctl daemon-reload
|
||||
ExecStart=/usr/bin/systemctl restart --no-block sockets.target timers.target multi-user.target
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
EOF
|
||||
} > /etc/systemd/system/ensure-symlinked-units-resolve.service
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now ensure-symlinked-units-resolve.service
|
||||
|
||||
|
||||
sh <(curl -L https://nixos.org/nix/install) --daemon
|
||||
|
||||
|
||||
sudo echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
|
||||
|
||||
echo "export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" >>
|
Loading…
Reference in New Issue
Block a user