Commit Graph

7115 Commits

Author SHA1 Message Date
Raito Bezarius
10baca4935 nixos/invidious: do not use ensureDBOwnership
Invidious uses a strange setup where the database name is different from the system username
for non-explicit reasons.

Because of that, it makes it hard to migrate it to use `ensureDBOwnership`, we leave it to Invidious' maintainers
to pick up the pieces.
2023-11-17 15:53:08 +01:00
Raito Bezarius
73198870cd nixos/tests/pgbouncer: do not use ensureDBOwnership
pgbouncer test is special in the sense where it actually tries
to connect via SCRAM SHA, let's avoid `ensureDBOwnership` here
otherwise for some reason pgbouncer will try to look in pg_shadow
for the authuser…
2023-11-17 15:52:51 +01:00
Maximilian Bosch
48459567ae nixos/postgresql: drop ensurePermissions, fix ensureUsers for postgresql15
Closes #216989

First of all, a bit of context: in PostgreSQL, newly created users don't
have the CREATE privilege on the public schema of a database even with
`ALL PRIVILEGES` granted via `ensurePermissions` which is how most of
the DB users are currently set up "declaratively"[1]. This means e.g. a
freshly deployed Nextcloud service will break early because Nextcloud
itself cannot CREATE any tables in the public schema anymore.

The other issue here is that `ensurePermissions` is a mere hack. It's
effectively a mixture of SQL code (e.g. `DATABASE foo` is relying on how
a value is substituted in a query. You'd have to parse a subset of SQL
to actually know which object are permissions granted to for a user).

After analyzing the existing modules I realized that in every case with
a single exception[2] the UNIX system user is equal to the db user is
equal to the db name and I don't see a compelling reason why people
would change that in 99% of the cases. In fact, some modules would even
break if you'd change that because the declarations of the system user &
the db user are mixed up[3].

So I decided to go with something new which restricts the ways to use
`ensure*` options rather than expanding those[4]. Effectively this means
that

* The DB user _must_ be equal to the DB name.
* Permissions are granted via `ensureDBOwnerhip` for an attribute-set in
  `ensureUsers`. That way, the user is actually the owner and can
  perform `CREATE`.
* For such a postgres user, a database must be declared in
  `ensureDatabases`.

For anything else, a custom state management should be implemented. This
can either be `initialScript`, doing it manual, outside of the module or
by implementing proper state management for postgresql[5], but the
current state of `ensure*` isn't even declarative, but a convergent tool
which is what Nix actually claims to _not_ do.

Regarding existing setups: there are effectively two options:

* Leave everything as-is (assuming that system user == db user == db
  name): then the DB user will automatically become the DB owner and
  everything else stays the same.

* Drop the `createDatabase = true;` declarations: nothing will change
  because a removal of `ensure*` statements is ignored, so it doesn't
  matter at all whether this option is kept after the first deploy (and
  later on you'd usually restore from backups anyways).

  The DB user isn't the owner of the DB then, but for an existing setup
  this is irrelevant because CREATE on the public schema isn't revoked
  from existing users (only not granted for new users).

[1] not really declarative though because removals of these statements
    are simply ignored for instance: https://github.com/NixOS/nixpkgs/issues/206467
[2] `services.invidious`: I removed the `ensure*` part temporarily
    because it IMHO falls into the category "manage the state on your
    own" (see the commit message). See also
    https://github.com/NixOS/nixpkgs/pull/265857
[3] e.g. roundcube had `"DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";`
[4] As opposed to other changes that are considered a potential fix, but
    also add more things like collation for DBs or passwords that are
    _never_ touched again when changing those.
[5] As suggested in e.g. https://github.com/NixOS/nixpkgs/issues/206467
2023-11-13 17:16:25 +01:00
Nick Cao
025064944d
Merge pull request #267120 from teutat3s/zhf/fix-prometheus-exporter-smokeping
nixosTests.prometheus-exporters.smokeping fix test
2023-11-12 20:23:34 -05:00
teutat3s
5458e56907
nixosTests.prometheus-exporters.smokeping fix test 2023-11-13 00:46:27 +01:00
K900
2e5993d508 nixos/tests/udisks2: actually start udisks 2023-11-12 12:09:58 +03:00
tomberek
7859adb9d6
Merge pull request #245394 from christoph-heiss/pkgs/sourcehut
sourcehut: update all component; lots of fixes
2023-11-11 13:42:19 -05:00
Peder Bergebakken Sundt
0e8902941b
Merge pull request #266469 from ambroisie/fix-tandoor-recipes
tandoor-recipes: fix `django-allauth`
2023-11-11 20:42:10 +02:00
Bruno BELANYI
2fa56fcb30 nixos/tests/tandoor-recipes: use SQLite
This is a work-around for getting the tests working until #216989 is
fixed.
2023-11-11 18:37:33 +00:00
Christoph Heiss
589b75bdc8
sourcehut: disable IPv6 completely for tests
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-11-11 13:01:47 +01:00
Christoph Heiss
78cc2783c8
sourcehut: drop obsolete services array in favor of indivdual enable flags
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-11-11 13:01:47 +01:00
Félix Baylac Jacqué
dfa45288af maintainers: ninjatrappeur -> picnoir
I changed my nickname from Ninjatrappeur to Picnoir. My github id is
stable, it shouldn't break too much stuff.

I took advantage of this handle change to remove myself from the
hostapd maintainers: I don't use NixOS as a router anymore.
2023-11-11 08:31:16 +01:00
Martin Weinelt
3536221702
Merge pull request #160346 from mweinelt/hass-custom-everything
home-assistant: custom components and lovelace modules
2023-11-11 00:08:25 +01:00
Martin Weinelt
c85cecedf1
nixos/tests/home-assistant: test custom things cleanup
Make sure we properly remove custom components and custom lovelace
modules, when they're not configured anymore.
2023-11-10 22:00:38 +01:00
Martin Weinelt
8108ce0a4f
nixos/tests/home-assistant: test loading custom components 2023-11-10 22:00:37 +01:00
Martin Weinelt
f2bd10bb1e
nixos/tests/home-assistant: test loading lovelace modules 2023-11-10 22:00:37 +01:00
Ryan Lahfa
b8218af2e6
Merge pull request #256226 from ElvishJerricco/systemd-stage-1-testing-backdoor 2023-11-10 14:08:07 +01:00
Lin Jian
36f4c90526
Merge pull request #266150 from robryk/resticnotimer
nixos/restic: allow timer to be disabled
2023-11-10 17:51:14 +08:00
Yureka
6d475b6d95 nixos/tests/sudo: check that sudo is enabled by default 2023-11-10 03:32:26 +01:00
Will Fancher
e9e2240763 nixos/tests/systemd-initrd-modprobe: Test parameter in stage 1 2023-11-09 17:53:49 -05:00
Will Fancher
b41cbee0fd nixos/tests/systemd-initrd-networkd-ssh: Test with backdoor not LUKS 2023-11-09 17:53:49 -05:00
Will Fancher
8900b027c7 nixos/tests/systemd-initrd-networkd: Use initrdBackdoor 2023-11-09 17:53:49 -05:00
Will Fancher
90e2658693 nixos/tests/systemd-initrd-networkd: Separate into different tests 2023-11-09 17:53:49 -05:00
Will Fancher
9a0f523372 systemd-stage-1: Enable backdoor in nixos tests 2023-11-09 17:53:48 -05:00
K900
63fe80d8d5
Merge pull request #266093 from K900/pipe-systemd-cat
treewide: replace `<command> | systemd-cat` with `systemd-cat <command>`
2023-11-08 11:28:44 +03:00
Artturi
c1cfba583d
Merge pull request #260050 from 6t8k/nixos-test-openssh-wait-for-sshd 2023-11-08 01:00:37 +02:00
Robert Obryk
20b202b3c8 nixos/restic: allow timer to be disabled 2023-11-07 22:37:37 +01:00
Weijia Wang
1dab6eb2ea nixosTests.shattered-pixel-dungeon: use wait_for_text 2023-11-07 19:33:16 +00:00
emilylange
03e7a22654 nixosTests.gitea: remove emilylange from maintainers
I no longer contribute to this test nor do I plan to do so in the
future.
My contributions moved to nixosTests.forgejo, after we (nixpkgs) decided
to split the gitea and forgejo nixpkgs modules.
2023-11-07 19:10:56 +01:00
K900
9843bbbeee treewide: replace <command> | systemd-cat with systemd-cat <command>
The former swallows exit codes, the latter doesn't.
2023-11-07 21:08:23 +03:00
K900
68b237a102
Merge pull request #265818 from K900/vaultwarden-1.30.0
Vaultwarden 1.30.0
2023-11-07 20:00:18 +03:00
Kerstin Humm
39f6f3e96a nixos/mobilizon: fix integration test by using postgresql_14 2023-11-07 16:29:40 +00:00
K900
7d4e359579 nixos/tests/vaultwarden: fix database creation 2023-11-07 18:30:16 +03:00
Janik
22aa256c6c
Merge pull request #264882 from robryk/resticfix
nixos/restic: fix #264696 and add a regression test
2023-11-07 09:46:55 +01:00
Martin Weinelt
a3708ce91c
Merge pull request #230380 from graham33/feature/zwave-js-server_module
zwave-js: module init, zwave-js-server: init at 1.33.0
2023-11-06 20:24:56 +01:00
Felix Buehler
b6b15798ef nixos/prometheus.exporters.pgbouncer: migrate from connectionString to connectionStringFile 2023-11-05 20:25:29 +01:00
Felix Buehler
e0a147a3c8 nixos/prometheus.exporters.knot: migrate from extraConfig to settingsFile 2023-11-05 20:24:46 +01:00
Jonas Heinrich
35128eb6f8
nixos/printing: Add openFirewall option (#176539) 2023-11-05 16:01:20 +01:00
Ryan Lahfa
0020a3f649
Merge pull request #265281 from JulienMalka/systemd-boot-maintainer 2023-11-05 13:03:59 +01:00
K900
163a50a5e1
nixos/tests/home-assistant: replace ensureUsers with custom setup script for now
(cherry picked from commit 30d70bf605)
2023-11-04 22:11:34 +01:00
Julien Malka
33df4d3447
nixos/systemd-boot: add julienmalka as maintainer 2023-11-04 02:38:11 +01:00
Lily Foster
5c5d730067
Merge pull request #262347 from adamcstephens/incus/module
nixos/incus: init module and tests
2023-11-03 09:42:24 -04:00
Michele Guerini Rocco
5654dea8a5
Merge pull request #264787 from katexochen/feat/xkb-extralayouts
nixos/x11: move extraLayouts into xkb attrset
2023-11-03 13:49:14 +01:00
Adam Stephens
f12af77bd8
nixos/tests/incus: improve test resiliency under load 2023-11-02 22:09:37 -04:00
Artturi
891e7b46b9
Merge pull request #261356 from l0b0/test/ssh-audit 2023-11-03 03:16:07 +02:00
Adam Stephens
3087595a6b
nixos/incus: preseed should not trigger socket-activation 2023-11-02 19:54:04 -04:00
Adam Stephens
1fff6a9031
nixos/incus: init module and tests 2023-11-02 19:54:02 -04:00
Graham Bennett
b2fccae809 zwave-js: module init, zwave-js-server: init at 1.33.0
Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
Co-authored-by: h7x4 <h7x4@nani.wtf>
2023-11-02 08:21:09 +00:00
Robert Obryk
536401e90a nixos/restic: fix #264696 and add a regression test
Make sure that preStart and postStop are included in all cases when they are nonempty.
2023-11-01 21:18:56 +01:00
K900
65d6075e14 nixos/tests/predictable-interface-names: fix eval for systemd-stage1 2023-11-01 22:09:25 +03:00