From 75dd969f7ef7cc1d3a58983bc92ae1b16e98596e Mon Sep 17 00:00:00 2001 From: dish Date: Tue, 31 Mar 2026 01:15:53 -0400 Subject: [PATCH] [marvin] move some files around and reformat them --- hosts/marvin/default.nix | 7 ++-- hosts/marvin/services/databases.nix | 37 +++++++++++++++++++ .../services/{booklore.nix => library.nix} | 5 ++- hosts/marvin/services/postgres.nix | 34 ----------------- 4 files changed, 44 insertions(+), 39 deletions(-) create mode 100644 hosts/marvin/services/databases.nix rename hosts/marvin/services/{booklore.nix => library.nix} (98%) delete mode 100644 hosts/marvin/services/postgres.nix diff --git a/hosts/marvin/default.nix b/hosts/marvin/default.nix index 2bcd8caf..b5ae2858 100644 --- a/hosts/marvin/default.nix +++ b/hosts/marvin/default.nix @@ -11,18 +11,18 @@ # keep-sorted start ./services/anubis.nix ./services/avahi.nix - ./services/booklore.nix ./services/bots.nix + ./services/databases.nix ./services/gdq-cals.nix ./services/git.nix ./services/golink.nix ./services/grafana.nix ./services/immich.nix ./services/jellyfin.nix - ./services/matrix.nix + ./services/library.nix ./services/mail-archiver.nix + ./services/matrix.nix ./services/miniflux.nix - ./services/mysql.nix ./services/nextcloud ./services/nginx.nix ./services/paperless.nix @@ -30,7 +30,6 @@ ./services/planka.nix ./services/pocket-id.nix ./services/podman.nix - ./services/postgres.nix ./services/prometheus.nix ./services/scrutiny.nix ./services/shelfmark.nix diff --git a/hosts/marvin/services/databases.nix b/hosts/marvin/services/databases.nix new file mode 100644 index 00000000..9d099f94 --- /dev/null +++ b/hosts/marvin/services/databases.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: +{ + services = { + postgresql = { + enable = true; + package = pkgs.postgresql_16; + enableJIT = true; + # Settings taken from [PGTune](https://pgtune.leopard.in.ua/) + # https://pgtune.leopard.in.ua/?dbVersion=16&osType=linux&dbType=mixed&cpuNum&totalMemory=16&totalMemoryUnit=GB&connectionNum&hdType=ssd + settings = { + # PGTune Settings + max_connections = "300"; + shared_buffers = "4GB"; + effective_cache_size = "12GB"; + maintenance_work_mem = "1GB"; + checkpoint_completion_target = 0.9; + wal_buffers = "16MB"; + default_statistics_target = 100; + random_page_cost = 1.1; + effective_io_concurrency = 200; + work_mem = "19418kB"; + huge_pages = "off"; + min_wal_size = "1GB"; + max_wal_size = "4GB"; + + max_worker_processes = 16; + max_parallel_workers = 16; + max_parallel_workers_per_gather = 4; + max_parallel_maintenance_workers = 4; + }; + }; + mysql = { + enable = true; + package = pkgs.mariadb; + }; + }; +} diff --git a/hosts/marvin/services/booklore.nix b/hosts/marvin/services/library.nix similarity index 98% rename from hosts/marvin/services/booklore.nix rename to hosts/marvin/services/library.nix index c78cd7c8..a4c6dc85 100644 --- a/hosts/marvin/services/booklore.nix +++ b/hosts/marvin/services/library.nix @@ -117,8 +117,11 @@ in isSystemUser = true; group = "booklore"; description = "Booklore service user"; + uid = 940; + }; + groups.booklore = { + gid = 940; }; - groups.booklore = { }; }; # Configure MySQL services.mysql = { diff --git a/hosts/marvin/services/postgres.nix b/hosts/marvin/services/postgres.nix deleted file mode 100644 index 1cb408dd..00000000 --- a/hosts/marvin/services/postgres.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs, ... }: -# let -# cfg = config.services.postgresql; -# in -{ - services.postgresql = { - enable = true; - package = pkgs.postgresql_16; - enableJIT = true; - # Settings taken from [PGTune](https://pgtune.leopard.in.ua/) - # https://pgtune.leopard.in.ua/?dbVersion=16&osType=linux&dbType=mixed&cpuNum&totalMemory=16&totalMemoryUnit=GB&connectionNum&hdType=ssd - settings = { - # PGTune Settings - max_connections = "300"; - shared_buffers = "4GB"; - effective_cache_size = "12GB"; - maintenance_work_mem = "1GB"; - checkpoint_completion_target = 0.9; - wal_buffers = "16MB"; - default_statistics_target = 100; - random_page_cost = 1.1; - effective_io_concurrency = 200; - work_mem = "19418kB"; - huge_pages = "off"; - min_wal_size = "1GB"; - max_wal_size = "4GB"; - - max_worker_processes = 16; - max_parallel_workers = 16; - max_parallel_workers_per_gather = 4; - max_parallel_maintenance_workers = 4; - }; - }; -} -- 2.51.2