2.4 KiB
2.4 KiB
Dotfiles
NixOS
Install instructions for NixOS. First open a shell with vim and git:
nix-shell -p git vim
EXT4
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
parted /dev/nvme0n1 -- mkpart root ext4 512MB 100%
parted /dev/nvme0n1 -- set 1 esp on
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkfs.ext4 -L NixOS /dev/nvme0n1p2
mount /dev/disk/by-label/NixOS /mnt
mkdir -p /mnt/boot
mount -o umask=077 /dev/disk/by-label/BOOT /mnt/boot
nixos-generate-config --root /mnt
ZFS
First stop the zfs-zed service, and unload the ZFS kernel modules:
systemctl stop zfs-zed
lsmod | grep zfs | cut -d' ' -f1 | xargs rmmod -f
Then add the following to /etc/nixos/configuration.nix
:
boot.supportedFilesystems = [ "zfs" ];
And rebuild the system:
nixos-rebuild switch --upgrade
Partition the disk:
parted --script /dev/nvme0n1 -- mklabel gpt mkpart esp fat32 1MiB 512MiB mkpart primary 512MiB 100% set 1 boot on
Create an encrypted pool:
zpool create -f -o ashift=12 -O encryption=on -O keyformat=passphrase -O mountpoint=none rpool /dev/nvme0n1p2
Create a root partition:
zfs create -o mountpoint=legacy rpool/root
mkdir -p /mnt
mount -t zfs rpool/root /mnt
And home partition:
zfs create -o mountpoint=legacy -o compression=on rpool/home
mkdir -p /mnt/home
mount -t zfs rpool/home /mnt/home
Format the boot partition:
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkdir -p /mnt/boot
mount -t vfat /dev/nvme0n1p1 /mnt/boot
Generate the configuration:
nixos-generate-config --root /mnt
Add the following to /mnt/etc/nixos/configuration.nix:
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
services.zfs.autoScrub.enable = true;
networking.hostName = "Aloria";
networking.hostId = "abcdef01";
Install
Then either clone the repository:
git clone https://git.thomasave.be/thomasave/Dotfiles
sudo nixos-install --impure --flake ./Dotfiles#Aloria
mv ./Dotfiles /mnt/home/user/.dotfiles
sudo ln -s /home/user/.dotfiles /mnt/etc/nixos
Or install it directly:
sudo nixos-install --impure --flake git+https://git.thomasave.be/thomasave/Dotfiles#Aloria
Post-install
Clean-up:
umount /mnt/{home,boot}
umount /mnt
If using ZFS:
zpool export -a