My NixOS config Part 3: Flake-Parts Crusaders
nix.ladas552.me
hjem
nix
nixos
impermanence
flake-parts
nvfetcher
niri
noctalia
1{
2 # I have this nasty bug that corrupts my /boot, I need to fix it
3 # but here is a script I use to not do it manually everytime
4 # Do this all in sudo tho
5
6 perSystem =
7 { pkgs, ... }:
8 {
9 packages.restore =
10 pkgs.writeShellScriptBin "restore.sh" # bash
11 ''
12 mkfs.vfat /dev/nvme0n1p5 -n NIXBOOT
13 zpool import zroot -f
14 # Need so that install doesn't run out of memory
15 zfs create -o mountpoint=legacy zroot/root
16 mount -t zfs zroot/root /mnt
17 mount --mkdir /dev/nvme0n1p5 /mnt/boot
18 mount --mkdir -t zfs zroot/nix /mnt/nix
19 mount --mkdir -t zfs zroot/tmp /mnt/tmp
20 mount --mkdir -t zfs zroot/cache /mnt/cache
21 mount --mkdir -t zfs zroot/persist /mnt/persist
22 nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
23 # unmount the system, and remount it to correctly link the build
24 umount /mnt/boot
25 umount /mnt/nix
26 umount /mnt/cache
27 umount /mnt/tmp
28 umount /mnt/persist
29 umount /mnt
30 mount --mkdir /dev/nvme0n1p5 /mnt/boot
31 mount --mkdir -t zfs zroot/nix /mnt/nix
32 mount --mkdir -t zfs zroot/tmp /mnt/tmp
33 mount --mkdir -t zfs zroot/cache /mnt/cache
34 mount --mkdir -t zfs zroot/persist /mnt/persist
35 nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
36 '';
37 };
38}