Commit Graph

784 Commits

Author SHA1 Message Date
jopejoe1
dca7e827b3 nixos: Replace custom cfg format handling with pkgs.formats (#314933) 2025-03-14 21:08:14 +01:00
Maximilian Bosch
25310642c6 Merge: nixos/postgresql: allow customisations of SystemCallFilter (#386345) 2025-03-11 17:11:28 +01:00
Sandro
bcfa2a020c nixos/postgresql: fix merging of shared_preload_libraries option (#388754) 2025-03-10 19:32:38 +01:00
Maximilian Bosch
8bf1e138bc nixos/postgresql: fix merging of shared_preload_libraries option
Closes #386804

The issue with coercing to `types.str` is that it's not mergeable, so
any declarations will result in an eval error like this:

    error: The option `interactive.nodes.tmp.services.postgresql.settings.shared_preload_libraries' has conflicting definition values:
    - In `/home/ma27/Projects/nixpkgs-hack/tmp.nix@node-tmp': "foo"
    - In `/home/ma27/Projects/nixpkgs-hack/tmp.nix@node-tmp': "bar2"
    Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Using a mergeable type (`types.comma`, i.e. a string, where all declarations
get joined with a comma as delimiter) fixes the problem.
2025-03-10 18:07:44 +01:00
6543
e00090dddf services.mysql: make sql statements consistent uppercase 2025-03-06 07:03:49 +01:00
6543
534f90a262 services.mysql: on create initial databases add savety statement 'IF NOT EXISTS' for edgecases 2025-03-06 07:03:49 +01:00
6543
41ec4243d1 services.mysql: wait for galera cluster sync to be done 2025-03-06 07:03:49 +01:00
Maximilian Bosch
6e87867ee3 nixos/postgresql: allow customisations of SystemCallFilter
Closes #385603

The problem described is that `wal-g` requires syscalls from `@resources`.
However, we don't have support for it in the module now and I don't
think it's reasonable to only support hardening adjustments for things
support by this module. Also, list is a bad datatype here since it
doesn't allow the level of customizations we need.

This is only for the syscall filterset since it's the option that's hard
to customize otherwise. For downstream configs, it's recommended to
adjust the hardening as needed in other cases.

Hence I decided to implement `services.postgresql.systemCallFilter` with
the following semantics:

* `systemCallFilter."~@resources" = true` adds `~@resources` to the
  filterset.

* Setting this to `false` (e.g. in a downstream configuration using
  `wal-g`) removes the entry `~@resources` from the filterset. In this
  case it's sufficient since `@system-service` implies `@resources` and
  the `~@resources` declaration after that discards that.

  I decided to not implement logic about negations in here, but to keep
  it rather simple by only allowing to set/unset entries.

As described in `systemd.exec(5)`, the ordering matters: e.g.
`@system-service` implies `@resources`, but `~@resources` _after_ that
reverts that. By default, the ordering of the keys is as follows:

* syscall groups (starting with `@`) come at first.
* negations of syscall groups (starting with `~@`) come after that.
* anything else at the end.

If further ordering is needed, it can be done like this:

```
{
  services.postgresql.systemCallFilter."~@resources" = {
    enable = true; # whether or not it's part of the final SystemCallFilter
    priority = 23; # ordering priority in the filterset.
  };
}
```

The lower the priority, the higher up the entry will be in the final
filterset.
2025-03-02 11:20:18 +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
Ivan Trubach
d8657587c0 nixos/victorialogs: init module (#376834) 2025-02-20 14:57:55 +03:00
Sam Willcocks
a3827a595e nixos/victorialogs: init module 2025-02-17 11:23:20 +00:00
nixpkgs-ci[bot]
43a5de6cbb Merge master into staging-next 2025-02-14 12:05:56 +00:00
6543
6449da32b2 nixos/services.mysql: add myselfe as maintainer 2025-02-14 01:06:52 +01:00
6543
0256f1180c nixos/services.mysql: format with nixfmt-rfc-style 2025-02-14 01:06:22 +01:00
Julien Langlois
37372eb227 nixos/postgresql/citus: fix syscall filter and add test 2025-02-09 18:07:27 -05:00
Arne Keller
cf577e4308 foundationdb: pin Boost 1.86 and fix Makefile (#376230) 2025-01-26 14:18:54 +01:00
Robert Rose
3701d859ae foundationdb: mark cross-compiling as broken 2025-01-24 09:44:58 +01:00
Niklas Korz
d223d3f15d nixos/mongodb: add pkgs.mongodb-ce as package option example 2025-01-21 18:25:39 +01:00
Niklas Korz
2f8af3ea93 nixos/mongodb: replace option initialRootPassword with initialRootPasswordFile 2025-01-21 18:25:39 +01:00
Niklas Korz
3f8a2242b2 nixos/mongodb: use mongosh instead of legacy shell 2025-01-21 18:25:39 +01:00
Maximilian Bosch
c1bf44ab55 Merge: nixos/postgresql: fix condition for readwritepaths (#372164) 2025-01-19 12:32:13 +01:00
Minijackson
08f182057f nixos/ferretdb: disable telemetry by default 2025-01-14 10:38:24 +01:00
Minijackson
3b3764df09 nixos/ferretdb: set default value for PostgreSQL URL
provides a nice default if the end user wants to use the PostgreSQL
backend
2025-01-14 10:38:23 +01:00
Minijackson
ccd19c4503 nixos/ferretdb: move default settings to options
so that they are documented in the options list
2025-01-14 10:38:22 +01:00
Sandro
641122c422 nixos/neo4j: add advertisedAddress options (#364250) 2025-01-12 21:40:11 +01:00
Martin Weinelt
4d0f802848 nixos/postgresql: fix condition for readwritepaths
In the case that the user wants to provide a custom data directory, we
need to grant `ReadWritePaths` for that directory. Previously this would
not happen when `/var/lib/postgresql` was used, because the condition
was not in fact checking for the default data directory, creating a gap
in then if-else scenario.

Fixes: #371680
2025-01-08 16:08:46 +01:00
piegames
dd7d5339f7 treewide: Fix incorrect string indentations 2025-01-07 19:49:28 +01:00
Emily
c1f8b214cc foundationdb: 7.1.32 -> 7.3.42
Includes fixes for GCC 14 and using non‐vendored libraries.
2024-12-30 12:35:07 +00:00
Arne Keller
0d9ea99d72 nixos/couchdb: Add support for additional config files (#358006) 2024-12-13 08:58:39 +01:00
Defelo
59ebd72118 nixos/neo4j: add advertisedAddress options 2024-12-12 22:37:15 +01:00
Tom Hubrecht
0bdb7a72b1 nixos/postgresql: Add finalPackage attribute
This allows refering to the actual installed package, which is necessary
when using plugins and wanting to use postgres in scripts
2024-12-12 16:54:06 +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
Mike Kusold
aed11df8a5 nixos/couchdb: Convert extraConfig to follow RFC42 2024-12-11 23:15:50 -07:00
Mike Kusold
82e0c6257a nixos/couchdb: Add support for additional config files
This allows users to set the Admin Password via secrets. `configFile` must be writable which is why it isn't sufficient.
nixfmt nixos/modules/services/databases/couchdb.nix
2024-12-11 23:11:08 -07:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Andrew Frahn
c146818be2 nixos/services.redis: complete removal of with lib; 2024-12-10 16:19:03 +11:00
Felix Buehler
db321b974a nixos/services.redis: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
36828aceef nixos/services.mongodb: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
035c17d408 nixos/services.monetdb: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
261e4890fb nixos/services.memcached: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
3aa36dd181 nixos/services.cockroachdb: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
fa6f1e3ce5 nixos/services.clickhouse: remove with lib; 2024-12-08 13:21:51 +01:00
Felix Buehler
f6ebc4cfe0 nixos/services.aerospike: remove with lib; 2024-12-08 13:21:51 +01:00
nicoo
ce799c73e5 nixos/influxdb: Replace custom drv with pkgs.formats.toml 2024-12-04 20:43:19 +00:00
Ryan Yin
534b77f858 nixos/victoriametrics: the prometheusConfig option isn't null by default 2024-12-04 22:54:29 +08:00
Maximilian Bosch
c055f6bc0a nixos/mysql: fix evaluation of percona test
Commit e14483d6a6 fixed a bug in the `ini`
type with `listsAsDuplicatedKeys = true;`: multiple list declarations
weren't merged, but latter declarations shadowed the former without any
error.

The fix brought another issue to surface however: before, the
`plugin-load-add` declaration in the MySQL test shadowed the
`auth_socket.so` setting in the module. But now the attempt
to merge a list and a single declaration breaks because of
`types.either` seeing a mix of declarations from the left
AND right type.

Turning the `plugin-load-add` in the module into a list triggers the
correct merging behavior and thus fixes the evaluation error (and
merging behavior of `plugin-load-add`)!

This wasn't an issue for mysql itself (empty `plugin-load-add` in the
test) and neither for mariadb (the `auth_socket.so` isn't added for
this).
2024-11-29 21:55:49 +01:00
Maximilian Bosch
4220a62d70 Merge: nixos/victoriametrics: check config, more tests & update desc (#353950) 2024-11-24 14:18:29 +01:00
Maximilian Bosch
0c8d661707 Merge: nixos/pgbouncer: rework RFC42 integration (#356965) 2024-11-23 09:20:09 +01:00
Ryan Yin
ad06fc936d nixos/victoriametrics: check config, more tests, update desc 2024-11-23 01:19:11 +08:00
Maximilian Bosch
2995b3825e nixos/pgbouncer: rework RFC42 integration
Commit bfb9d1825d added RFC42 support
which is a good thing in general, but this implementation has the
following flaws:

* `services.pgbouncer.logFile` was not renamed to `[...].log_file`, but
  to `[...].logfile`. Also the use of `mkRenamedOptionModule` is
  inappropriate here because the two options are not equivalent: the old
  option took a path relative to the home directory, the new an absolute
  path.

* Using `mkRenamedOptionModule` with options that don't exist (but are
  keys in a freeform attr-set or an `attrsOf X`), you get the following
  error when referencing an option you didn't declare:

    error: evaluation aborted with the following error message: 'Renaming error: option `services.pgbouncer.settings.pgbouncer.listen_port' does not exist.'

  This error is pretty bad because it's not actionable for an end-user of
  the module. A possible use-case is doing

    networking.firewall.allowedTCPPorts = [ config.services.pgbouncer.listenPort ];

  without specifying a custom listen port. This is an example of why you
  want to keep options, they already contain defaults and you can re-use
  those defaults in other parts of your system configuration.

  I decided to re-add a bunch of options where I figured that it's
  either useful to be able to address those in the NixOS configuration
  or having documentation directly in the options' reference in the
  NixOS manual.

  I didn't add all options, I'll leave that to the maintainers of
  pgbouncer.
2024-11-22 17:01:36 +01:00