{ pkgs, config, service_configs, lib, ... }: { imports = [ (lib.serviceMountWithZpool "postgresql" service_configs.zpool_ssds [ config.services.postgresql.dataDir ]) (lib.serviceFilePerms "postgresql" [ "Z ${config.services.postgresql.dataDir} 0700 postgres postgres" ]) ]; services.postgresql = { enable = true; package = pkgs.postgresql_16; dataDir = service_configs.postgres.dataDir; settings = { # ZFS provides checksumming and atomic writes, making PostgreSQL's # full_page_writes redundant. Disabling reduces write amplification # and SSD wear on the zpool. # Did this in conjunction with setting recordsize=8k # on the zvolume this is on full_page_writes = false; }; }; }