2024-10-12 15:17:51 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-04-20 13:42:06 +00:00
|
|
|
{
|
2023-02-25 16:22:31 +00:00
|
|
|
|
2024-04-20 13:42:06 +00:00
|
|
|
options = {
|
|
|
|
zfs.enable = lib.mkEnableOption "ZFS file system.";
|
|
|
|
};
|
2023-02-25 16:22:31 +00:00
|
|
|
|
2023-07-18 02:00:38 +00:00
|
|
|
config = lib.mkIf (config.server && config.zfs.enable) {
|
2023-02-25 16:22:31 +00:00
|
|
|
|
2023-07-18 02:00:38 +00:00
|
|
|
# Only use compatible Linux kernel, since ZFS can be behind
|
2024-10-12 15:17:51 +00:00
|
|
|
boot.kernelPackages = pkgs.linuxPackages; # Defaults to latest LTS
|
2023-07-18 02:00:38 +00:00
|
|
|
boot.kernelParams = [ "nohibernate" ];
|
|
|
|
boot.supportedFilesystems = [ "zfs" ];
|
2024-04-20 13:42:06 +00:00
|
|
|
services.prometheus.exporters.zfs.enable = config.prometheus.exporters.enable;
|
2023-07-18 02:00:38 +00:00
|
|
|
prometheus.scrapeTargets = [
|
2024-04-20 13:42:06 +00:00
|
|
|
"127.0.0.1:${builtins.toString config.services.prometheus.exporters.zfs.port}"
|
2023-07-18 02:00:38 +00:00
|
|
|
];
|
|
|
|
};
|
2023-02-25 16:22:31 +00:00
|
|
|
}
|