Commit Graph

109 Commits

Author SHA1 Message Date
Pyrox
11255ef03c
maintainers: thehedgeh0g -> pyrox0
Also updates my information and contact info.

I no longer use The Hedgehog as my github username or online presence
username, so this fixes that. It also matches my github username, so it
should be easier for others to mention me if needed.
2024-04-24 12:53:58 -04:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07: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
emilylange
ca3cfc841a
nixos/gitea: warn when using services.gitea with forgejo
since this is no longer supported and we have a dedicated module for
forgejo for quite some time now.

Such warning is, however, becoming more and more important, since
forgejo is no longer a soft-fork of gitea, but rather a hard-fork.

And as such, it will slowly but surely no longer be a drop-in
replacement.

Additionally, I hope that this warning will prevent users from
reporting issues with forgejo to nixos/gitea maintainers.

The accompanying forgejo.md, from which the manual section is created,
will be updated over the next few weeks when forgejo officially
publishes their blog post about all this and the way forward, so we can
link to it.
2024-02-10 20:47:04 +01:00
Maximilian Bosch
571f06ad0d
Merge pull request #270260 from SuperSandro2000/gitea-camo-hmac
nixos/gitea: add hmacKey support
2023-12-20 19:02:20 +01:00
Sandro Jäckel
1ebb7d7bba
nixos/gitea: add hmacKey support 2023-12-18 23:44:24 +01:00
h7x4
0a37316d6c
treewide: use mkPackageOption
This commit replaces a lot of usages of `mkOption` with the package
type, to be `mkPackageOption`, in order to reduce the amount of code.
2023-11-27 01:28:36 +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
Tristan Daniël Maat
b59e5a34e7
nixos/gitea: Add option to supply the metrics token via file 2023-10-07 21:53:02 +02:00
Florian Praden
490ec79ac3
nixos/gitea: bugfix for gitea-dump service.
Missing custom directory setup in gitea-dump service. Adding environment variable in gitea-dump service definition.
2023-08-09 11:53:18 +02:00
Maximilian Bosch
ed02e79bbe
Merge pull request #241497 from bendlas/prepare-gitea-120
nixos/gitea: add WORK_PATH to config, fix 1.20
2023-08-04 18:50:09 +02:00
Raito Bezarius
44aee34594 Revert "nixos/gitea: set service type to notify"
This reverts commit b61919e5e0.

As it breaks Forgejo who does not support this feature yet.
2023-07-22 16:12:36 +02:00
Maximilian Bosch
7c70396c1d
Merge pull request #242863 from emilylange/nixos/gitea-runtimedirmode
nixos/gitea: revert change to RuntimeDirectoryMode
Closes ##243340
2023-07-21 19:22:05 +02:00
Maximilian Bosch
b61919e5e0
nixos/gitea: set service type to notify 2023-07-20 22:20:43 +02:00
Maximilian Bosch
42105b2ba3
nixos/gitea: explicitly set CHUNKED_UPLOAD_PATH to writable location
Fix for Gitea 1.20.0.

Without this being set, e.g. a `git push` (or `ssh` to `git@` in general) fails like this:

    2023/07/17 09:27:05 ...s/setting/setting.go:109:LoadCommonSettings() [F] Unable to load settings from config: unable to create chunked upload directory: /nix/store/yna9nf66wl2n9hlnhxi2g7fdgawk2kxl-gitea-1.20.0/bin/data/tmp/package-upload (mkdir /nix/store/yna9nf66wl2n9hlnhxi2g7fdgawk2kxl-gitea-1.20.0/bin/data: read-only file system)
    Connection to git.mbosch.me closed.
2023-07-17 11:49:34 +02:00
emilylange
da58b13615
nixos/gitea: revert change to RuntimeDirectoryMode
As this broke most unix socket setups and there is a far better suited
`server.UNIX_SOCKET_PERMISSION` in gitea/forgejo itself.

https://docs.gitea.io/en-us/administration/config-cheat-sheet/#server-server

ref: a0311e5107
2023-07-11 17:05:45 +02:00
Maximilian Bosch
b82c8e13c7
Merge pull request #228508 from SuperSandro2000/gitea-no-recurse
nixos/gitea: don't recursively change file owners/permissions
2023-07-05 13:56:46 +02:00
Maximilian Bosch
7f0bc68c32
Merge pull request #237544 from hrdinka/fix_gitea
Revert "nixos/gitea: requires database"
2023-07-05 12:09:55 +02:00
Herwig Hochleitner
5205c73d93 nixos/gitea: add WORK_PATH to config
this is in preparation for 1.20, which needs this option set
2023-07-04 16:05:56 +02:00
Christoph Hrdinka
70cc0d412f
nixos/gitea: only require databases if createDatabase is set
Currently the database service (mysql/postgresql) is required by the
gitea service. If none of them exists on the same machine as gitea it
will refuse to start. With this change it is only required if
createDatabase was set to true.
2023-07-03 17:02:12 +02:00
Izorkin
a0311e5107
nixos/gitea: update sandboxing options 2023-06-28 23:28:56 +03:00
happysalada
ba3d0f7a95 nixos/gitea: requires database 2023-06-03 05:14:46 -04:00
Sandro Jäckel
93242070ae nixos/gitea: don't recursively change file owners/permissions
This scales really poor with lots of files.
eg. 300000 take minutes to finish on SSD
2023-04-27 13:31:52 +02:00
David Knaack
3856e84b79 nixos/gitea: remove extra " in prestart 2023-04-22 09:12:02 +02:00
ThinkChaos
70cf02924e
nixos/gitea: convert more simple settings to freeform
Also update `settings.server.PROTOCOL` to use non deprecated values.
2023-04-19 12:18:47 -04:00
ThinkChaos
2901c2f94e
nixos/gitea: quote paths in preStart script 2023-04-19 12:18:47 -04:00
ThinkChaos
eba0db3c1c
nixos/gitea: add customDir option
Use case is storing secrets in a non persistent directory as I manage
them separately from this module.
2023-04-19 12:18:47 -04:00
ThinkChaos
f7b9a1c561
nixos/gitea: disable LFS related code when it is not configured 2023-04-19 12:18:47 -04:00
ThinkChaos
184131f50d
nixos/gitea: make service group configurable 2023-04-19 12:18:46 -04:00
ThinkChaos
f8d5d6cd02
nixos/gitea: disable createDatabase assert when using sqlite
Assert doesn't make sense in that case since `database.user` isn't used.
2023-04-19 12:18:46 -04:00
Sandro Jäckel
20842ac039
nixos/gitea: disable updater by default 2023-03-23 14:46:51 +01:00
Maximilian Bosch
72f45f225f
Merge pull request #218269 from theHedgehog0/gitea-module-getexe
nixos/gitea: Move to lib.getExe
2023-03-02 19:46:45 +01:00
Pyrox
98dd7f5307
nixos/gitea: Move to lib.getExe
This makes it so that alternative packages, such as `pkgs.forgejo` are
able to be used instead of the default `pkgs.gitea`.

Also adds myself as a maintainer of the module.

The varible `gitea`, which was used instead of `cfg.package`, has been
replaced with the variable `exe`, and is instead the value of the main
executable, as gotten from `lib.getExe`. `cfg.package` is used when this
value is not appropriate.
2023-03-02 12:16:30 -05:00
IndeedNotJames
93c1d370db
nixos/gitea: fix commit signing (gpg) core dump
Gitea spawns `gpg` processes for commit signing related actions.
Those `gpg` processes need `mlock` (probably to prevent secrets
in the memory to swap).
Blocking it (as part of the `@memlock` preset) causes any
commit signing related actions to error out as http/500
2023-03-01 23:44:21 +01:00
Dmitriy Kholkin
8e6f6d7db1
nixos/gitea: add tar.zst to the dump type 2023-01-16 03:34:11 +03:00
Naïm Favier
7d3f7637c6
Merge pull request #210965 from Izorkin/fix-gitea 2023-01-15 21:50:58 +01:00
Izorkin
1fd7d52d82
nixos/gitea: fix creation of data directory 2023-01-15 21:33:21 +03:00
Maximilian Bosch
6f474d1af4
Merge pull request #209495 from amesgen/gitea-dump-activation
nixos/gitea: don't run gitea-dump on activation
2023-01-15 19:28:03 +01:00
amesgen
a429cecd3c
nixos/gitea: don't run gitea-dump on activation 2023-01-07 15:50:36 +01:00
Maximilian Bosch
0cd88dbc60
nixos/gitea: adapt configs for 1.18
Co-authored-by: Izorkin <izorkin@elven.pw>
2023-01-02 11:19:04 +01:00
figsoda
6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Daniel Nagy
dbe8182e74
treewide: switch to port type for nixos modules 2022-12-01 22:30:00 +01:00
teutat3s
6033e4e5ed
gitea: needs gnupg in its path to sign commits
See: https://docs.gitea.io/en-us/signing/#installing-and-generating-a-gpg-key-for-gitea
2022-11-27 15:01:32 +01:00
MidAutumnMoon
e04013af1a nixos/gitea: set proper SystemCallFilter
remove trailing whitespace
2022-10-24 22:18:42 +10:00
pennae
1d41cff3dc nixos/*: convert straggler options to MD 2022-08-31 17:27:38 +02:00
pennae
6039648c50 nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00
pennae
7e7d68a250 nixos/*: mark pre-existing markdown descriptions as mdDoc 2022-08-19 22:40:58 +02:00
pennae
50f9b3107a
Merge pull request #185474 from pennae/option-docs-md
nixos/*: more options md conversion
2022-08-12 23:23:26 +02:00
pennae
087472b1e5 nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
pennae
423545fe48 nixos/*: normalize manpage references to single-line form
now nix-doc-munge will not introduce whitespace changes when it replaces
manpage references with the MD equivalent.

no change to the manpage, changes to the HTML manual are whitespace only.
2022-08-05 18:34:50 +02:00