diff --git a/containers/postgresql-configuration.nix b/containers/postgresql-configuration.nix new file mode 100644 index 00000000..f25c7ca7 --- /dev/null +++ b/containers/postgresql-configuration.nix @@ -0,0 +1,7 @@ +{ system, ... }: +{ + inherit system; + config = import ./postgresql.nix; + autoStart = true; + privateNetwork = true; +} diff --git a/containers/postgresql.nix b/containers/postgresql.nix new file mode 100644 index 00000000..7da0a4e1 --- /dev/null +++ b/containers/postgresql.nix @@ -0,0 +1,27 @@ +{ + config, + pkgs, + system, + ... +}: +{ + imports = [ + ./default.nix + ]; + services.postgresql = { + dataDir = "/persistent/${config.services.postgresql.package.psqlSchema}"; + enable = true; + enableJIT = system != "riscv64-linux"; + enableTCPIP = true; + extraPlugins = ps: with ps; [ rum ]; + package = + if config.services.postgresql.enableJIT then pkgs.postgresql_17_jit else pkgs.postgresql_17; + }; + services.postgresqlBackup = { + compression = "zstd"; + compressionLevel = 19; + enable = true; + location = "/persistent/pgbackup"; + }; + system.stateVersion = "24.11"; +} diff --git a/flake.nix b/flake.nix index 210016d9..20523548 100644 --- a/flake.nix +++ b/flake.nix @@ -149,6 +149,7 @@ let containerNames = [ "default" + "postgresql" ]; containerArches = [ "x86_64-linux"