{
  flake,
  config,
  ...
}:
let
  inherit (flake.config.people) user0;
  inherit (flake.config.machines.devices) mars eris ceres;
  sambaSecrets = config.sops.secrets."network/server".path;
in
{
  fileSystems =
    let
      storageDrives = [
        "storage0"
        "storage1"
      ];
      erisDrives = [
        "samba0"
      ];
      erisFolders = [
        "raid0"
      ];
      ceresDrives = [
        "samba0"
      ];
      ceresFolders = [
        "storage"
      ];
      storageMounts = storageDrive: {
        name = "${mars.${storageDrive}.mount}";
        value = {
          device = mars.${storageDrive}.device;
          fsType = "ext4";
          options = mars.${storageDrive}.options;
        };
      };
      erisMounts = sambaDrive: folder: {
        name = "${eris.${sambaDrive}.mount}/${folder}";
        value = {
          device = "${eris.${sambaDrive}.device}/${folder}";
          fsType = "cifs";
          options = eris.${sambaDrive}.options ++ [
            "credentials=${sambaSecrets}"
          ];
        };
      };
      ceresMounts = sambaDrive: folder: {
        name = "${ceres.${sambaDrive}.mount}/${folder}";
        value = {
          device = "${ceres.${sambaDrive}.device}/${folder}";
          fsType = "cifs";
          options = ceres.${sambaDrive}.options ++ [
            "credentials=${sambaSecrets}"
          ];
        };
      };
    in
    {
      "/" = {
        device = "/dev/disk/by-uuid/9055101b-f60d-4d5f-93f5-8b9d480b1a19";
        fsType = "ext4";
      };
      "/boot" = {
        device = "/dev/disk/by-uuid/A8CE-EB9B";
        fsType = "vfat";
        options = mars.boot.options;
      };
    }
    // (builtins.listToAttrs (map storageMounts storageDrives))
    // (builtins.listToAttrs (
      builtins.concatMap (drive: map (folder: ceresMounts drive folder) ceresFolders) ceresDrives
    ))
    // (builtins.listToAttrs (
      builtins.concatMap (drive: map (folder: erisMounts drive folder) erisFolders) erisDrives
    ));

  swapDevices = [
    { device = "/dev/disk/by-uuid/6b56990c-545d-4d00-b93b-8ca1f143882e"; }
  ];

  systemd.tmpfiles.rules = [
    "Z ${config.home-manager.users.${user0}.home.homeDirectory} 0755 ${user0} users -"
    "Z ${mars.storage0.mount} 0755 ${user0} users -"
    "Z ${mars.storage1.mount} 0755 ${user0} users -"
  ];

  services.udisks2.enable = true;
}
