Warning
Disable composefs
or enable root.transient
before install and use nix on Fedora Silverblue 42. Do not mix both. Use just one method. I prefer enabling root.transient
.
-
sudo sed -i 's/,ro//' /etc/fstab sudo rpm-ostree kargs --append='ostree.prepare-root.composefs=0' --reboot
-
sudo tee /etc/ostree/prepare-root.conf <<'EOL' [composefs] enabled = yes [root] transient = true EOL rpm-ostree initramfs-etc --reboot --track=/etc/ostree/prepare-root.conf
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
sh -s -- install ostree --no-confirm --persistence=/var/lib/nix
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --update
echo "Defaults secure_path = /nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$(sudo printenv PATH)" | sudo tee /etc/sudoers.d/nix-sudo-env
-
This is a single user install.
-
For multi user install and without changing selinux mode: https://gist.github.com/matthewpi/08c3d652e7879e4c4c30bead7021ff73
-
Please note that these instructions are not offically supported or condoned by Nix and are not guaranteed to always work, but from my testing everything seems to work perfectly fine.
-
sudo setenforce Permissive sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
-
sudo mkdir /var/lib/nix sudo chown $USER:$USER /var/lib/nix
-
/etc/systemd/system/[email protected]
[Unit] Description=Enable mount points in / for ostree ConditionPathExists=!%f DefaultDependencies=no Requires=local-fs-pre.target After=local-fs-pre.target [Service] Type=oneshot ExecStartPre=chattr -i / ExecStart=mkdir -p '%f' ExecStopPost=chattr +i /
-
[Unit] Description=Nix Package Manager DefaultDependencies=no After[email protected] Wants[email protected] Before=sockets.target After=ostree-remount.service BindsTo=var.mount [Mount] What=/var/lib/nix Where=/nix Options=bind Type=none [Install] WantedBy=local-fs.target
-
# Ensure systemd picks up the newly created units sudo systemctl daemon-reload # Enable the nix mount on boot. sudo systemctl enable nix.mount # Mount the nix mount now. sudo systemctl start nix.mount
-
sh <(curl -L https://nixos.org/nix/install) --no-daemon
-
Load Nix into your environment. The installer modified
~/.bash_profile
, but it isn't used when you start a terminal from desktop, it's only used when using a full shell login withbash -l
, which doesn't happen on silverblue.tee --append $HOME/.bashrc <<EOF # Nix Package Manager if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then source $HOME/.nix-profile/etc/profile.d/nix.sh; fi EOF
-
Links:
With
composefs
enabledroot
subvolume mount options in /etc/fstab are ignored. But withcomposefs
disabled root subvolume mounted asro
(readonly). This is not like that before with Silverblue 41 etc. Silverblue 42 install addro
flag for root mount. So we need to mountrw
or erasero
flag from /etc/fstab.That why disabling
composefs
not working.after these two command it should work. I will update my howto accordantly.