dotfiles/modules/nixos/hardware/zfs.nix

24 lines
690 B
Nix
Raw Normal View History

2023-02-25 16:22:31 +00:00
{ config, pkgs, lib, ... }: {
options = { zfs.enable = lib.mkEnableOption "ZFS file system."; };
config =
lib.mkIf (pkgs.stdenv.isLinux && config.server && config.zfs.enable) {
# Only use compatible Linux kernel, since ZFS can be behind
boot.kernelPackages =
config.boot.zfs.package.latestCompatibleLinuxPackages;
2023-02-26 13:23:31 +00:00
boot.kernelParams = [ "nohibernate" ];
boot.supportedFilesystems = [ "zfs" ];
2023-07-16 13:50:58 +00:00
services.prometheus.exporters.zfs.enable =
config.prometheus.exporters.enable;
prometheus.scrapeTargets = [
"127.0.0.1:${
builtins.toString config.services.prometheus.exporters.zfs.port
}"
];
2023-02-25 16:22:31 +00:00
};
}