diff --git a/modules/config/hydra.nix b/modules/config/hydra.nix index 8984d65..93fb981 100644 --- a/modules/config/hydra.nix +++ b/modules/config/hydra.nix @@ -12,13 +12,25 @@ useSubstitutes = true; }; + # ZFS dataset properties: + # atime=off + # compression=zstd + # recordsize=16K services.postgresql = { - package = pkgs.postgresql_13; + package = pkgs.postgresql_17; dataDir = "/var/db/postgresql-${config.services.postgresql.package.psqlSchema}"; settings = { max_connections = 250; work_mem = "8MB"; - shared_buffers = "512MB"; + shared_buffers = "4GB"; + # ZFS ARC defaults to 50% of RAM + effective_cache_size = "64GB"; + # ZFS writes are atomic, so this is unnecessary + # See: https://wiki.postgresql.org/wiki/Full_page_writes + full_page_writes = "off"; + # Useless with CoW + wal_init_zero = "off"; + wal_recycle = "off"; }; }; diff --git a/modules/tasks/filesystems/zfs.nix b/modules/tasks/filesystems/zfs.nix index 9265f97..bf078aa 100644 --- a/modules/tasks/filesystems/zfs.nix +++ b/modules/tasks/filesystems/zfs.nix @@ -2,8 +2,9 @@ { config, lib, pkgs, ... }: with lib; mkIf (config.boot.supportedFilesystems.zfs or false) (mkMerge [ ({ boot = { + # Use default LTS kernel # Lower priority than mkForce to allow devices to use custom kernels - kernelPackages = mkOverride 75 config.boot.zfs.package.latestCompatibleLinuxPackages; + kernelPackages = mkOverride 75 pkgs.linuxPackages; zfs = { # Recommended to be disabled to avoid potential corruption forceImportRoot = false;