79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
cfg = config.databank.zfs;
|
|
in {
|
|
options.databank.zfs = {
|
|
enable = lib.mkEnableOption "enables zfs";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# set network host id
|
|
networking.hostId = "3e6e7055";
|
|
|
|
# enable zfs support
|
|
boot.kernelModules = ["zfs"];
|
|
boot.supportedFilesystems = ["zfs"];
|
|
|
|
# arc cache size
|
|
boot.kernelParams = [ "zfs.zfs_arc_max=12884901888" ];
|
|
|
|
# pools to import
|
|
#boot.zfs.extraPools = [ "databank" "databank/archives" "/databank/media" "/databank/users" ];
|
|
#boot.zfs.extraPools = [ "databank" ];
|
|
|
|
# enable smart monitoring
|
|
services.smartd = {
|
|
enable = true;
|
|
autodetect = true;
|
|
defaults.monitored = "-a -o on -s (S/../.././05|L/../01/./05)";
|
|
notifications.mail = {
|
|
enable = true;
|
|
sender = "zfs@snowbelle.lan";
|
|
};
|
|
};
|
|
|
|
# enable zfs
|
|
services.zfs = {
|
|
autoScrub.enable = true;
|
|
autoScrub.interval = "weekly";
|
|
# email notifs
|
|
zed = {
|
|
enableMail = true;
|
|
settings = {
|
|
ZED_EMAIL_ADDR = ["root"];
|
|
# send notification if scrub succeeds
|
|
ZED_NOTIFY_VERBOSE = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
# install userspace tools for acl's
|
|
environment.systemPackages = with pkgs; [smartmontools];
|
|
|
|
fileSystems."/databank" = {
|
|
device = "databank";
|
|
fsType = "zfs";
|
|
options = ["nofail"];
|
|
};
|
|
fileSystems."/databank/archives" = {
|
|
device = "databank/archives";
|
|
fsType = "zfs";
|
|
options = ["nofail"];
|
|
};
|
|
fileSystems."/databank/users" = {
|
|
device = "databank/users";
|
|
fsType = "zfs";
|
|
options = ["nofail"];
|
|
};
|
|
fileSystems."/databank/media" = {
|
|
device = "databank/media";
|
|
fsType = "zfs";
|
|
options = ["nofail"];
|
|
};
|
|
};
|
|
}
|