49 Commits
Author SHA1 Message Date
Wolfgang Walther e5699f2308 postgresqlPackages.plv8: drop
`plv8` depends on the outdated NodeJS 20. Upstream waits for v8-cmake to
make a move (https://github.com/plv8/plv8/issues/610), but that project
has been inactive for a bit more than a year.

Even when allowing the insecure nodejs20, the package fails to build.
Insecure and broken - we might as well drop it.
2026-06-13 11:53:42 +02:00
znmz ff1f398de0 treewide: fix typos in all markdown files 2026-05-17 13:02:47 +03:00
Bart Louwers 7f707274cf doc: fix nix repl command in NixOS manual 2026-04-03 12:09:53 +02:00
Maximilian BoschandGitHub 6acb057de6 nixos/postgresql: document difference between postgresql.target and postgresql.service (#473313) 2025-12-29 12:20:27 +00:00
Bart Louwers b7343ece65 doc: fix rendering issue in postgresql documentation 2025-12-26 21:24:21 +01:00
Anton Mosich f4d0f170b4 nixos/postgres: fix markup in docs 2025-12-23 00:04:24 +01:00
Maximilian Bosch 7a6ec4a99d nixos/postgresql: document difference between postgresql.target and postgresql.service
It's probably good to have this written down explicitly in the manual.
2025-12-22 22:35:37 +01:00
Leona MaroniandWolfgang Walther a3f56d583f postgresql_13: drop as it's EOL 2025-11-18 12:32:17 +01:00
Augustin TrancartandWolfgang Walther 30ba7d34a2 postgresql: document the use of callPackage 2025-10-31 19:49:53 +01:00
dish 970dcca69c treewide: Fix links in module documentation 2025-08-25 12:55:11 -04:00
Wolfgang Walther 62fe016519 treewide: run treefmt with mdcr/nixfmt 2025-07-24 13:52:31 +02:00
Wolfgang Walther 6c47e7d5da treewide: fix syntax errors in nix code blocks
Fixes all code blocks with "nix" language in markdown files for syntax
errors to be able to run nixfmt in the next step.
2025-07-24 13:52:29 +02:00
Kamil Monicz f9339c853e nixos/postgresql: document beta versioning 2025-07-05 15:36:17 +02:00
Maximilian Bosch e031c5ff6b nixos/postgresql: add section about pg_config
See https://discourse.nixos.org/t/i-cannot-for-the-life-of-me-find-the-package-that-has-pg-config/66244/4

I decided against doing this in its own nixpkgs manual: the line
to draw is quite blurry already (e.g. we have documented our package
removal policy in here as well) and having to check two manuals for a
single subsystem feels pretty annoying to me.

The relevant part - where to find pg_config - is written at the top. I
decided to give a bit more context about the way our packaging works
since I realized a few times now that I don't remember all the details
about the problems we had in the past and having to look up individual
commit messages for that isn't very productive.
2025-07-03 19:33:01 +02:00
Wolfgang Walther 9656e1aa9d nixos/postgresql: make postgresql.target wait until recovery is done
The new postgresql.target will now wait until recovery is done and
read/write connections are possible.

This allows ensure* scripts and downstream migrations to work properly
after recovery from backup.

Resolves #346886
2025-06-24 15:26:48 +02:00
Wolfgang WaltherandMarcel 41c5662cbe nixos/postgresql: move postStart into separate unit
This avoids restarting the postgresql server, when only ensureDatabases
or ensureUsers have been changed. It will also allow to properly wait
for recovery to finish later.

To wait for "postgresql is ready" in other services, we now provide a
postgresql.target.

Resolves #400018

Co-authored-by: Marcel <me@m4rc3l.de>
2025-06-24 15:26:47 +02:00
2a6405fb15 nixos/postgresql: doc review
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-06-15 10:33:11 +02:00
Maximilian Bosch e6cc23ba3f nixos/postgresql: fix docs on default package
Closes #416595
2025-06-14 23:25:43 +02:00
Wolfgang Walther 3d29b7d3a2 nixos/postgresql: improve local peer authentication with default map
This allows to easily map allowed database roles to system users.
2025-05-11 10:24:21 +02:00
nixpkgs-ci[bot]andGitHub d9eb3e5d48 Merge staging-next into staging 2025-03-28 12:06:30 +00:00
Maximilian BoschandGitHub 360cd99eed Merge: nixos/doc: include extensions in postgresql upgrade script (#392831) 2025-03-28 10:33:00 +01:00
K900 aca918e668 Merge remote-tracking branch 'origin/staging-next' into staging 2025-03-25 21:06:52 +03:00
Wolfgang Walther 7277ebc2f9 Reapply "nixos/postgresql: add docs about procedural languages"
This reverts commit a4006e4970.
2025-03-25 15:00:50 +01:00
Wolfgang Walther a4006e4970 Revert "nixos/postgresql: add docs about procedural languages"
This reverts commit 0bc099abd6.
2025-03-25 14:58:02 +01:00
Kai 4867d68ec9 nixos/doc: include extensions in postgresql upgrade script 2025-03-25 07:59:01 +01:00
Wolfgang Walther 0bc099abd6 nixos/postgresql: add docs about procedural languages 2025-03-23 15:07:43 +01:00
Wolfgang Walther 24775f6543 nixos/postgresql: fix reference to LLVM closure size
In fact, the current difference is:
- 157M for postgresql to
- 756M for postgresql_jit

That's a difference of 589M.
2025-03-23 15:07:39 +01:00
Wolfgang Walther 89b30e5b15 nixos/postgresql: fix spelling and grammar in docs 2025-03-23 15:07:36 +01:00
Peder Bergebakken Sundt d525eb5838 treewide: fix typos
done with `fd \\\.md$ . --type f -x typos --write-changes`
2025-02-22 02:02:07 +01:00
Maximilian Bosch 51a6938a44 nixos/doc: document how to allow-list tablespaces
It was brought up that the restricted file-system access breaks
tablespaces[1]. I'd argue that this is the desired behavior, the whole
point of the hardening is the lock the service down and I don't consider
tablespaces common enough to elevate privileges again. Especially since
the workaround is trivial as shown in the diff.

For completeness sake, this adds the necessary `ReadWritePaths` change
to the postgresql section of the manual.

This also adds a small correction about the state of
`ensurePermissions`.

[1] https://github.com/NixOS/nixpkgs/pull/344925#issuecomment-2521188907
2024-12-12 13:42:52 +01:00
SandroandGitHub 3156de49ba nixos/postgresql: update docs with extraPlugins to extensions rename 2024-11-22 15:48:08 +01:00
Maximilian Bosch 0b3eef7441 postgresql_12: remove
This will be EOL at the end of November, so there's little reason to
keep it in 24.11[1]. As discussed, we'd like to keep it for as long as
possible to make sure there's a state in nixpkgs that has the latest
minor of postgresql_12 available with the most recent CVEs fixed for
people who cannot upgrade[2].

This aspect has been made explicit in the manual now for the next .11
release.

During the discussions it has been brought up that if people just do
`services.postgresql.enable = true;` and let the code decide the
postgresql version based on `system.stateVersion`, there's a chance that
such EOL dates will be missed. To make this harder, a warning will now
be raised when using the stateVersion-condition and the oldest still
available major is selected.

Additionally regrouped the postgresql things in the release notes to
make sure these are all shown consecutively. Otherwise it's a little
hard to keep track of all the changes made to postgresql in 24.11.

[1] https://endoflife.date/postgresql
[2] https://github.com/NixOS/nixpkgs/pull/353158#issuecomment-2453056692
2024-11-15 09:17:06 +01:00
Maximilian Bosch 70a6092f1e nixos/doc: mention postgresql hardening 2024-11-01 16:31:35 +01:00
Maximilian Bosch 11d1f8776c nixos/postgresql: escape initdbArgs
It doesn't look correct that this isn't the case already.
2024-09-29 21:03:52 +02:00
Maximilian BoschandGitHub 0e78dc369c Merge: doc: use initdbArgs in example postgresql upgrade script (#302823) 2024-09-29 20:39:05 +02:00
Sergei Trofimovich f3ece34945 nixos/postgresql: fix documentation markdown
Without the change the doc build fails as:

    $ nix build -f nixos config.system.build.manual.manualHTML -L
    ...
    nixos-manual-html> RuntimeError: heading in line 366 does not have an id
2024-08-25 17:09:36 +01:00
Wolfgang Walther 435f51c37f postgresql: split dev output
This splits a dev output to make the default output not depend on any
build dependencies anymore. This also avoids removing references from
pgxs' Makefile this way, which should, at least theoretically, be good
to build extensions via pgxs, making sure they use the same tooling.

ecpg is the "embedded SQL C preprocessor", which is certainly a dev
tool.

Most important, for closure size anyway, is to move pg_config to the dev
output, since it retains paths to all the other outputs.

The only thing with references to the dev output remaining is then the
postgres binary itself. It contains all the output paths, because it
shows those in the pg_config system view. There is no other way than
to nuke those references to avoid circular dependencies between outputs
- and blowing up closure size again.
2024-08-23 21:37:49 +02:00
Wolfgang Walther 0487937af3 postgresql: add readme with eol-policy
This was discussed and agreed on in [1].

[1]: https://github.com/NixOS/nixpkgs/pull/310580#discussion_r1597284693
2024-06-14 09:38:23 +02:00
Robin Appelman a3184ef2bf doc: use initdbArgs in example postgresql upgrade script
it's likely that the configured initdbArgs will still be relevant after the upgrade.
2024-04-09 14:34:58 +02:00
Maximilian Bosch 5142b7afa8 nixos/postgresql: turn settings into a submodule
The main idea behind that was to be able to do more sophisticated
merging for stuff that goes into `postgresql.conf`:
`shared_preload_libraries` is a comma-separated list in a `types.str`
and thus not mergeable. With this change, the option accepts both a
comma-separated string xor a list of strings.

This can be implemented rather quick using `coercedTo` +
freeform modules. The interface still behaves equally, but it allows to
merge declarations for this option together.

One side-effect was that I had to change the `attrsOf (oneOf ...)` part into
a submodule to allow declaring options for certain things. While at it,
I decided to move `log_line_prefix` and `port` into this structure as
well.
2024-03-30 14:23:05 +01:00
Janne HeßandValentin Gagarin fcc95ff817 treewide: Fix all Nix ASTs in all markdown files
This allows for correct highlighting and maybe future automatic
formatting. The AST was verified to work with nixfmt only.
2024-03-28 09:28:12 +01:00
Janne HeßandValentin Gagarin bc77c7a973 treewide: Mark Nix blocks in markdown as Nix
This should help us with highlighting and future formatting.
2024-03-28 09:28:12 +01:00
Wolfgang Walther 4b6bce5c31 postgresql: refactor to remove "this" argument
This was proposed by abbradar in #150801, but left out of the follow up PR
#221851 by Ma27 to reduce the size of the diff. Compared to the initial
proposal this includes the callPackage call in the recursion, which avoids
breaking the withJIT/withoutJIT helpers.

In terms of nixpkgs, this is a pure refactor, no derivations change. However,
this makes downstream expressions like the following possible:

  (postgresql.override { jitSupport = true; }).pkgs.postgis

This would have not worked before without passing another "this" argument,
which is error prone as can be seen in this example:

  https://github.com/PostgREST/postgrest/pull/3222/files
2024-03-15 21:11:09 +01:00
Sandro Jäckel 4fe5824fc7 nixos/postgresql: take extraPlugins packageset from package option
This allows to reuse the extraPlugins option in other context's for
example an upgrade script.
2023-12-08 14:58:18 +01:00
e7c7d97167 nixos/postgresql: document psql 15 changes (#267238)
* nixos/postgresql: document psql 15 changes

* nixos/postgresql: manual heading ids

* nixos/postgresql: reword warning against initialScript

Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>

* nixos/postgresql: wording PERMISSIONS -> PRIVILEGES

Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>

* nixos/postgresql: document intermediate oneshot / service user method

* nixos/postgresql/docs: clarify security benefits of `ensureDBOwnership`

* nixos/postgresql/docs: service type -> serviceConfig.Type

---------

Co-authored-by: Ryan Lahfa <masterancpp@gmail.com>
2023-11-17 16:06:01 +01:00
Anthony Roussel e30f48be94 treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
Maximilian Bosch 1220a4d4dd postgresql_11: remove
As described in the release lifecycle docs from postgresql[1], v11 will
stop receiving fixes as of Nov 9 2023. This means it's EOL throughout
the entire lifetime of 23.11, so let's drop it now.

A lot of examples are also referencing postgresql_11. Where it's
sensible, use postgresql_15 as example now to avoid confusion.

This is also handy because the LLVM 16 fix for postgresql is not
available for postgresql 11 ;-)

[1] https://www.postgresql.org/support/versioning/
2023-10-30 10:41:16 +01:00
Maximilian Bosch 43dbeae02d postgresql: pass through JIT-enabled variant of non-JIT postgres and vice versa
This is useful if your postgresql version is dependant on
`system.stateVersion` and not pinned down manually. Then it's not
necessary to find out which version exactly is in use and define
`package` manually, but just stay with what NixOS provides as default:

    $ nix-instantiate -A postgresql
    /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv
    $ nix-instantiate -A postgresql_jit
    /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv
    $ nix-instantiate -A postgresql.withJIT
    /nix/store/qsjkb72fcrrfpsszrwbsi9q9wgp39m50-postgresql-14.7.drv
    $ nix-instantiate -A postgresql.withJIT.withoutJIT
    /nix/store/82fzmb77mz2b787dgj7mn4a8i4f6l6sn-postgresql-14.7.drv

I.e. you can use postgresql with JIT (for complex queries only[1]) like
this:

    services.postgresql = {
      enable = true;
      enableJIT = true;
    };

Performing a new override instead of re-using the `_jit`-variants for
that has the nice property that overlays for the original package apply
to the JIT-enabled variant, i.e.

    with import ./. {
      overlays = [
        (self: super: {
          postgresql = super.postgresql.overrideAttrs (_: { fnord = "snens"; });
        })
      ];
    };
    postgresql.withJIT.fnord

still gives the string `snens` whereas `postgresql_jit` doesn't have the
attribute `fnord` in its derivation.

[1] https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-JIT-ABOVE-COST
2023-03-29 08:39:46 +02:00
pennae 453b2bed05 nixos/postgresql: convert manual chapter to MD 2023-01-10 10:31:55 +01:00