NixOS, Alpine Linux: mount datasets in Root on ZFS guide; immutable
root; GRUB update Acknowledgement: @bjornstromberg Closes #398 NixOS: remove NetworkManager by default, add note for enable Signed-off-by: Maurice Zhou <jasper@apvc.uk>
This commit is contained in:
committed by
George Melikov
parent
90172151d5
commit
5b8c163e24
@@ -6,16 +6,15 @@ Preparation
|
||||
.. contents:: Table of Contents
|
||||
:local:
|
||||
|
||||
This guide supports x86_64 and arm64-efi architectures.
|
||||
**Note for arm64**
|
||||
|
||||
**Note for Tow-Boot**
|
||||
Currently there is a bug with the grub installation script. See `here
|
||||
<https://github.com/NixOS/nixpkgs/issues/222491>`__ for details.
|
||||
|
||||
`Tow-Boot firmware <https://tow-boot.org/>`__
|
||||
enables UEFI boot on many affordable arm64 based computers. If
|
||||
using Tow-Boot, NixOS and Tow-Boot must be on separate disks.
|
||||
Example, Tow-Boot is installed to an SD card. Then the SD card
|
||||
should not be also shared with NixOS. Install NixOS to an external
|
||||
disk instead.
|
||||
**Note for Immutable Root**
|
||||
|
||||
Immutable root can be enabled or disabled by setting
|
||||
``zfs-root.boot.immutable`` option inside per-host configuration.
|
||||
|
||||
#. Disable Secure Boot. ZFS modules can not be loaded if Secure Boot is enabled.
|
||||
#. Download `NixOS Live Image
|
||||
|
||||
@@ -126,7 +126,7 @@ System Installation
|
||||
mount -t zfs rpool/nixos/root /mnt/
|
||||
zfs create -o mountpoint=legacy rpool/nixos/home
|
||||
mkdir /mnt/home
|
||||
mount -t zfs rpool/nixos/home /mnt/home
|
||||
mount -t zfs rpool/nixos/home /mnt/home
|
||||
zfs create -o mountpoint=legacy rpool/nixos/var
|
||||
zfs create -o mountpoint=legacy rpool/nixos/var/lib
|
||||
zfs create -o mountpoint=legacy rpool/nixos/var/log
|
||||
@@ -134,6 +134,10 @@ System Installation
|
||||
zfs create -o mountpoint=legacy bpool/nixos/root
|
||||
mkdir /mnt/boot
|
||||
mount -t zfs bpool/nixos/root /mnt/boot
|
||||
mkdir -p /mnt/var/log
|
||||
mkdir -p /mnt/var/lib
|
||||
mount -t zfs rpool/nixos/var/lib /mnt/var/lib
|
||||
mount -t zfs rpool/nixos/var/log /mnt/var/log
|
||||
zfs create -o mountpoint=legacy rpool/nixos/empty
|
||||
zfs snapshot rpool/nixos/empty@start
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ System Configuration
|
||||
sed -i "s|\"bootDevices_placeholder\"|$diskNames|g" \
|
||||
/mnt/etc/nixos/hosts/exampleHost/default.nix
|
||||
|
||||
sed -i "s|\"hostId_placeholder\"|\"$(head -c4 /dev/urandom | od -A none -t x4| sed 's| ||g')\"|g" \
|
||||
sed -i "s|\"abcd1234\"|\"$(head -c4 /dev/urandom | od -A none -t x4| sed 's| ||g')\"|g" \
|
||||
/mnt/etc/nixos/hosts/exampleHost/default.nix
|
||||
|
||||
sed -i "s|\"systemType_placeholder\"|\"$(uname -m)-linux\"|g" \
|
||||
sed -i "s|\"x86_64-linux\"|\"$(uname -m)-linux\"|g" \
|
||||
/mnt/etc/nixos/flake.nix
|
||||
|
||||
#. Set root password::
|
||||
@@ -52,8 +52,8 @@ System Configuration
|
||||
"s|rootHash_placeholder|${rootPwd}|" \
|
||||
/mnt/etc/nixos/hosts/exampleHost/default.nix
|
||||
|
||||
#. Optional: add SSH public key for root and change host name in
|
||||
``/mnt/etc/nixos/hosts/exampleHost/default.nix``.
|
||||
#. You can enable NetworkManager for wireless networks and GNOME
|
||||
desktop environment in ``configuration.nix``.
|
||||
|
||||
#. From now on, the complete configuration of the system will be
|
||||
tracked by git, set a user name and email address to continue::
|
||||
@@ -76,8 +76,6 @@ System Configuration
|
||||
|
||||
nixos-install --no-root-passwd --flake "git+file:///mnt/etc/nixos#exampleHost"
|
||||
|
||||
If the host name was changed, use the new host name in this command.
|
||||
|
||||
#. Exit ephemeral nix shell with git::
|
||||
|
||||
exit
|
||||
@@ -91,22 +89,6 @@ System Configuration
|
||||
|
||||
reboot
|
||||
|
||||
#. NetworkManager is enabled by default. To manage network
|
||||
connections, execute::
|
||||
|
||||
nmtui
|
||||
|
||||
#. Optional: immutable root filesystem can be enabled by setting
|
||||
``my.boot.immutable`` option to ``true``.
|
||||
then execute::
|
||||
|
||||
nixos-rebuild boot
|
||||
|
||||
Then reboot. You may need to make certain
|
||||
adjustments to where configuration files are stored,
|
||||
see `NixOS wiki <https://nixos.wiki/wiki/ZFS>`__ for
|
||||
details.
|
||||
|
||||
Replace a failed disk
|
||||
=====================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user