helm/modules/hardware/fs.nix
Henrik Lissner a75c64d04a
Rewrite to use flakes
This puts a hard dependency on 20.09, but that's to be expected.
2020-10-11 01:31:33 -04:00

47 lines
1.1 KiB
Nix

{ config, options, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.hardware.fs;
in {
options.modules.hardware.fs = {
enable = mkBoolOpt false;
zfs.enable = mkBoolOpt false;
ssd.enable = mkBoolOpt false;
# TODO automount.enable = mkBoolOpt false;
};
config = mkIf cfg.enable (mkMerge [
{
programs.udevil.enable = true;
# Support for more filesystems, mostly to support external drives
environment.systemPackages = with pkgs; [
sshfs
exfat
ntfs3g
hfsprogs
];
}
(mkIf (!cfg.zfs.enable && cfg.ssd.enable) {
services.fstrim.enable = true;
})
(mkIf cfg.zfs.enable (mkMerge [
{
boot.loader.grub.copyKernels = true;
boot.supportedFilesystems = [ "zfs" ];
boot.zfs.devNodes = "/dev/disk/by-partuuid";
services.zfs.autoScrub.enable = true;
}
(mkIf cfg.ssd.enable {
# Will only TRIM SSDs; skips over HDDs
services.fstrim.enable = false;
services.zfs.trim.enable = true;
})
]))
]);
}