about summary refs log tree commit diff
path: root/sys
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-01 21:15:57 +0000
committerAlyssa Ross <hi@alyssa.is>2023-10-02 09:29:57 +0000
commitd4c9a79d9a14c398a85fd37a6183667102748969 (patch)
tree21abcd7635c6b6cf87ddb933d1f04c5d80fbee9d /sys
parent7c9ce97bc96c4d965792b15a61276dd32b581259 (diff)
downloadnixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar.gz
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar.bz2
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar.lz
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar.xz
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.tar.zst
nixlib-d4c9a79d9a14c398a85fd37a6183667102748969.zip
sys/mbp.nix: fix erasing /
Just deleting the "boot" subvolume stopped working, because deleting a
subvolume isn't recursive with respect to child subvolumes, and
systemd started creating more subvolumes.  The fix is to add another
subvolume under /persist for /var/lib/portables, and add another
special bind-mounted subvolume for /tmp, so it's not actually below /,
and have that also be deleted on boot.

I've also taken the opportunity to rename "boot", because it was easy
to confuse with /boot.
Diffstat (limited to 'sys')
-rw-r--r--sys/mbp.nix20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/mbp.nix b/sys/mbp.nix
index 1c595142c65a..202933a9553d 100644
--- a/sys/mbp.nix
+++ b/sys/mbp.nix
@@ -16,8 +16,10 @@
   boot.initrd.postDeviceCommands = ''
     mkdir /mnt
     mount /dev/mapper/root /mnt
-    btrfs subvolume delete /mnt/boot
-    btrfs subvolume create /mnt/boot
+    for subvol in @ tmp; do
+        btrfs subvolume delete "/mnt/$subvol"
+        btrfs subvolume create "/mnt/$subvol"
+    done
     umount /mnt
   '';
 
@@ -38,7 +40,13 @@
   fileSystems."/" = {
     device = "/dev/disk/by-uuid/e5821c99-7507-421d-9280-de09a055d926";
     fsType = "btrfs";
-    options = [ "subvol=boot" ];
+    options = [ "subvol=@" ];
+  };
+
+  fileSystems."/tmp" = {
+    device = "/dev/disk/by-uuid/e5821c99-7507-421d-9280-de09a055d926";
+    fsType = "btrfs";
+    options = [ "subvol=tmp" ];
   };
 
   fileSystems."/home" = {
@@ -77,6 +85,12 @@
     options = [ "subvol=persist/safe/var/lib/machines" ];
   };
 
+  fileSystems."/var/lib/portables" = {
+    device = "/dev/disk/by-uuid/e5821c99-7507-421d-9280-de09a055d926";
+    fsType = "btrfs";
+    options = [ "subvol=persist/safe/var/lib/portables" ];
+  };
+
   networking.hostName = "mbp";
 
   users.users.qyliss.hashedPassword = "$y$j9T$qdvgrHPyvZpqjUQXuagxD1$dq5yygUTVhVqpgG9.zWaihmtED437Cl.fllqJBEWSo4";