final: prev: let filesystem = fsType: path: device: options: { fileSystems.${path} = { inherit device fsType; } // final.optionalAttrs (options != null) { inherit options; }; }; in { btrfs = filesystem "btrfs"; ntfs = filesystem "ntfs-3g"; ext4 = filesystem "ext4"; vfat = filesystem "vfat"; zfs = filesystem "zfs"; tmpfs = filesystem "tmpfs"; swap = device: {swapDevices = [{inherit device;}];}; luks = mapper: device: additional: { boot.initrd.luks.devices.${mapper} = { inherit device; } // additional; }; }