{ config, lib, ... }: let cfg = config.my.fs; in { imports = [ ./btrfs.nix ./ext4.nix ./luks.nix ./ssd.nix ]; options.my.fs = { bootPartition = lib.mkEnableOption null // { default = true; }; device = lib.mkOption { type = lib.types.path; default = "/dev/disk/by-label/nixos"; }; snapshots = lib.mkEnableOption null; swapPartition = lib.mkEnableOption null; type = lib.mkOption { type = with lib.types; nullOr (enum [ "btrfs" "ext4" ]); default = null; }; }; config = { fileSystems = lib.mkIf cfg.bootPartition { "/boot" = { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; options = [ "umask=0077" ]; }; }; swapDevices = lib.mkIf cfg.swapPartition [ {device = "/dev/disk/by-label/swap";} ]; }; }