My NixOS config Part 3: Flake-Parts Crusaders
nix.ladas552.me
hjem
nix
nixos
impermanence
flake-parts
nvfetcher
niri
noctalia
1@document.meta
2title: impermanence
3description: Commands I used to Install zfs with impermanence
4authors: ladas552
5tangle: ./impermanence.sh
6@end
7Create an editable script with `:Neorg tangle current-file`
8
9So, create Boot Disk with gparted, idk. and /dev/sdaN for zpool too
10
11* Creating Partitions
12
13 - echo "Creating base zpool"
14 @code sh
15 sudo zpool create -f \
16 -o ashift=12 \
17 -o autotrim=on \
18 -O compression=zstd \
19 -O acltype=posixacl \
20 -O atime=off \
21 -O xattr=sa \
22 -O normalization=formD \
23 -O mountpoint=none \
24 zroot "/dev/sda2"
25 @end
26* Mounting Partitions
27 - echo "Creating /", as this is an impermanence setup we don't actually need `/root`, but otherwise the whole system build will be on the usb flash drive and I don't have enough space for that. So we just create this temporary and remove it once we are booted into an actual system.
28 @code sh
29 sudo zfs create -o mountpoint=legacy zroot/root
30 sudo mount -t zfs zroot/root /mnt
31 @end
32
33 - echo "Mounting /boot (efi)"
34 "$BOOTDISK" Is your `/dev/sda1` of wherever your /boot should be
35 @code sh
36 sudo mount --mkdir "$BOOTDISK" /mnt/boot
37 @end
38
39 - echo "Creating /nix"
40 @code sh
41 sudo zfs create -o mountpoint=legacy zroot/nix
42 sudo mount --mkdir -t zfs zroot/nix /mnt/nix
43 @end
44
45 - echo "Creating /tmp"
46 @code sh
47 sudo zfs create -o mountpoint=legacy zroot/tmp
48 sudo mount --mkdir -t zfs zroot/tmp /mnt/tmp
49 @end
50
51 - echo "Creating /cache"
52 @code sh
53 sudo zfs create -o mountpoint=legacy zroot/cache
54 sudo mount --mkdir -t zfs zroot/cache /mnt/cache
55 @end
56
57 - echo "Creating /persist"
58 Only use do that if you have impermanence setup
59 @code sh
60 sudo zfs create -o mountpoint=legacy zroot/persist
61 sudo zfs snapshot zroot/persist@blank
62 sudo mount --mkdir -t zfs zroot/persist /mnt/persist
63 @end
64* Install the OS
65 - Transfer keys
66 namely to `/mnt/persist/home/${meta.user}/.ssh/` so sops could find ssh key and setup secrets
67
68 - install nixos without root-password because immutable user already has password set
69 @code sh
70 sudo nixos-install --no-root-password --flake "github:Ladas552/Nix-Is-Unbreakable#NixVM"
71 @end
72 It should install system in `/mnt`