From efd06d6dde83e2558afcf77a7356783a248a4d34 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Tue, 19 Nov 2024 06:06:12 +0000 Subject: [PATCH] Set up ZFS mounts and bind mounts The ZFS datasets here had non-legacy mountpoints, so they were being imported by ZFS itself because of the extraPools setting in default.nix. Mounting them in the NixOS config required setting them to mountpoint=legacy; otherwise, the mount fails and systemd goes into emergency mode. --- machine/backyard/filesystems.nix | 59 +++++++++++++------------------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/machine/backyard/filesystems.nix b/machine/backyard/filesystems.nix index 5162b87..2914a44 100644 --- a/machine/backyard/filesystems.nix +++ b/machine/backyard/filesystems.nix @@ -1,50 +1,39 @@ { config, lib, pkgs, modulesPath, ... }: - +let + zfsMount = dev: { device = dev; fsType = "zfs"; options = [ "nofail" ]; }; + bindMount = dev: { device = dev; options = [ "bind" "nofail" ]; }; +in { - # Core filesystems - fileSystems."/" = - { device = "/dev/disk/by-uuid/75addc56-2a0d-431e-a0c5-f6ee0e370e61"; + fileSystems = { + # Core filesystems + "/" = { + device = "/dev/disk/by-uuid/75addc56-2a0d-431e-a0c5-f6ee0e370e61"; fsType = "ext4"; }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/610F-1EB7"; + "/boot" = { + device = "/dev/disk/by-uuid/610F-1EB7"; fsType = "vfat"; options = [ "fmask=0022" "dmask=0022" ]; }; - # ZFS filesystems - fileSystems."/pool/tvb" = - { device = "pool/user/tvb"; - fsType = "zfs"; - }; + # ZFS filesystems + "/pool/tvb" = zfsMount "pool/user/tvb"; - fileSystems."/pool/tvb/doc" = - { device = "pool/user/tvb/doc"; - fsType = "zfs"; - }; + "/home/tvb/doc" = zfsMount "pool/user/tvb/doc"; + "/pool/tvb/doc" = bindMount "/home/tvb/doc"; - fileSystems."/pool/tvb/game" = - { device = "pool/user/tvb/game"; - fsType = "zfs"; - }; + "/home/tvb/game" = zfsMount "pool/user/tvb/game"; + "/pool/tvb/game" = bindMount "/home/tvb/game"; - fileSystems."/pool/tvb/video" = - { device = "pool/user/tvb/video"; - fsType = "zfs"; - }; + "/home/tvb/video" = zfsMount "pool/user/tvb/video"; + "/pool/tvb/video" = bindMount "/home/tvb/video"; - fileSystems."/pool/tvb/audio" = - { device = "pool/user/tvb/audio"; - fsType = "zfs"; - }; + "/home/tvb/audio" = zfsMount "pool/user/tvb/audio"; + "/pool/tvb/audio" = bindMount "/home/tvb/audio"; - fileSystems."/pool/tvb/image" = - { device = "pool/user/tvb/image"; - fsType = "zfs"; - }; + "/home/tvb/image" = zfsMount "pool/user/tvb/image"; + "/pool/tvb/image" = bindMount "/home/tvb/image"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/cc464bb4-e1c8-46c0-adbb-ea1a3cfa5b03"; } - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/cc464bb4-e1c8-46c0-adbb-ea1a3cfa5b03"; } ]; }