Init:start-nix

This commit is contained in:
dichgrem
2025-07-22 12:18:15 +08:00
parent 7ce7214a74
commit e57cdd246c
178 changed files with 22667 additions and 1 deletions

42
modules/system/zfs.nix Normal file
View File

@@ -0,0 +1,42 @@
{
hostname,
lib,
pkgs,
...
}: let
inherit
(import ../../hosts/${hostname}/env.nix)
KernelPackages
ZFS-Networking-HostID
ZFS-Use-Case
;
in
with lib; {
config = mkIf ZFS-Use-Case {
boot = {
kernelParams = ["zfs_force=1"];
supportedFilesystems = ["zfs"];
zfs = {
devNodes = "/dev/disk/by-id";
forceImportRoot = false;
package = mkIf (strings.hasInfix "linuxPackages_cachyos" KernelPackages) pkgs.zfs_cachyos;
};
};
networking.hostId = ZFS-Networking-HostID;
services.zfs = {
autoScrub = {
enable = true;
interval = "weekly";
};
trim = {
enable = true; # HDD no need
interval = "weekly";
};
autoSnapshot.enable = true;
};
systemd.services = {
zfs-share.enable = mkForce false;
zfs-zed.enable = mkForce false;
};
};
}