{ config, lib, ... }: with lib; let cfg = config.system.fileSystemLayouts; defaultMountOptions = [ "compress-force=zstd:15" # This saves disk space, at a performance cost "noatime" # should have some performance upsides, and I don't use it anyways "lazytime" # make time changes in memory ]; in { options.system.fileSystemLayouts = { enable = mkEnableOption (mdDoc "fileSystemLayout"); mainDisk = mkOption { type = lib.types.path; example = literalExpression "/dev/disk/by-uuid/0442cb6d-f13a-4635-b487-fa76189774c5"; description = lib.mdDoc "Path to the main disk"; }; efiDisk = mkOption { type = lib.types.path; example = literalExpression "/dev/disk/by-uuid/5143-6136"; description = lib.mdDoc "Path to the main disk"; }; }; config = mkIf cfg.enable { fileSystems = { "/" = { device = "none"; fsType = "tmpfs"; options = ["defaults" "size=2G" "mode=755"]; }; "/nix" = { device = cfg.mainDisk; fsType = "btrfs"; options = ["subvol=nix-store"] ++ defaultMountOptions; }; "/srv" = { device = cfg.mainDisk; fsType = "btrfs"; neededForBoot = true; options = ["subvol=persistent-storage"] ++ defaultMountOptions; }; "/boot" = { device = cfg.efiDisk; fsType = "vfat"; }; #"${config.users.users.soispha.home}" = { # TODO this causes infinite recursion "/home/soispha" = { device = "none"; fsType = "tmpfs"; # Can be stored on normal drive or on tmpfs as well options = ["defaults" "size=4G" "mode=755"]; }; }; swapDevices = []; }; }