Commit graph

112 commits

Author SHA1 Message Date
Philipp 620f813ef4
nixos/services.mysql: Fix restart on-abnormal 2025-08-04 10:23:03 +02:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Martin Weinelt 91e217aad1
nixos/mysql: replace nettools with hostname-debian
If it just needs the hostname utility this is the better maintained
choice.
2025-07-06 00:59:37 +02:00
6543 2ab1f218fb nixos/services.mysql: fix galeraCluster.clusterAddress is evaluated before assertions are checked 2025-04-07 21:04:44 +02:00
6543 cac3bdab21
nixos/services.mysql: add galera cluster options (#388978)
And add release notes for new option.

Co-authored-by: Arne Keller <arne.keller@posteo.de>
2025-04-06 00:26:06 +02: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
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
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
Aleksana dbed5a6265
nixos/mysql: fix permission error during first startup (#331296) 2024-11-11 18:49:32 +08:00
Felix Buehler 8e91c6b7b3 nixos/services.mysql: remove with lib; 2024-08-29 00:20:49 +02:00
Felix Uhl 10538b82df nixos/mysql: fix permission error during first startup
When mysql starts up for the first time, the binary `mysql_install_db`
will run and try to set up the correct folder structure and permissions.

The very first step is to change the owner and group of the data
directory. This can fail in some cases, for example if `cfg.dataDir` is
something like `/mnt/mysql`:

```
Jul 31 15:24:35 junction systemd[1]: Starting MySQL Server...
Jul 31 15:24:36 junction mysql-pre-start[1346]: chown: changing ownership of '/mnt/mysql': Operation not permitted
Jul 31 15:24:36 junction mysql-pre-start[1309]: Cannot change ownership of the database directories to the 'mysql'
Jul 31 15:24:36 junction mysql-pre-start[1309]: user.  Check that you have the necessary permissions and try again.
Jul 31 15:24:36 junction systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Jul 31 15:24:36 junction systemd[1]: mysql.service: Failed with result 'exit-code'.
Jul 31 15:24:36 junction systemd[1]: Failed to start MySQL Server.
```

This is because `/mnt` usually is owned by root.

To work around this issue, use `systemd.tmpfiles` to set the owner,
group and permissions. This will always work, and if the permissions are
already set as expected, mysql will not try to alter them again.
2024-07-31 15:49:23 +02: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
Josh Hoffer b445085c22 nixos/mysql: Use notify service type for MySQL >= 8.0 2024-02-11 15:41:25 -08:00
Josh Hoffer e553e37abf nixos/mysql: remove MySQL fixed 30 second timeout
Removed hard coded timeout in postScript, allow using
more general systemd TimeoutStartSec instead.
2024-02-11 15:41:25 -08:00
Naïm Favier 0ff3b35356 nixos/doc: fix some options 2022-12-08 17:52:52 +01:00
pennae 722b99bc0e nixos/*: convert options with admonitions to MD
rendering changes only slightly, most changes are in spacing.
2022-08-31 16:36:16 +02:00
pennae ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae 6039648c50 nixos/*: automatically convert option docs 2022-08-19 22:40:58 +02:00
pennae b51f8036c2 nixos/*: use properly indented strings for option docs
using regular strings works well for docbook because docbook is not as
whitespace-sensitive as markdown. markdown would render all of these as
code blocks when given the chance.
2022-08-19 22:40:58 +02:00
pennae 61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae 16102dce2f nixos/*: replace <code> in option docs with <literal>
markdown can't represent the difference without another extension and
both the html manual and the manpage render them the same, so keeping the
distinction is not very useful on its own. with the distinction removed
we can automatically convert many options that use <code> tags to markdown.

the manpage remains unchanged, html manual does not render
differently (but class names on code tags do change from "code" to "literal").
2022-08-03 21:03:23 +02:00
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Aaron Andersen d621ad09a8 nixos/mysql: minor cleanup and formatting 2021-12-22 08:57:18 -05:00
Aaron Andersen a96f6ef187 nixos/mysql: remove services.mysql.bind and services.mysql.port in favor of services.mysql.settings 2021-12-22 08:57:14 -05:00
Aaron Andersen 76457da532 nixos/mysql: remove services.mysql.extraOptions in favor of services.mysql.settings 2021-12-18 21:01:48 -05:00
Aaron Andersen f1d1d319ae nixos/mysql: update user and group descriptions 2021-12-18 21:01:48 -05:00
Aaron Andersen c7cac1bdc0 nixos/mysql: use systemd StateDirectory to provision the data directory 2021-12-18 21:01:42 -05:00
Naïm Favier 2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Daniel Nagy 4037c974f5
nixos/mysql: use port type 2021-06-18 17:26:55 +02:00
talyz 59e0120aa5
treewide: Fix mysql alias deprecation breakage
62733b37b4 broke evaluation in all
places `pkgs.mysql` was used. Fix this by changing all occurrences to
`pkgs.mariadb`.
2021-06-04 21:42:08 +02:00
Aaron Andersen 4b9262786d nixos/mysql: properly configure mariadb for galera recovery 2021-02-17 15:50:20 -05:00
Aaron Andersen f08049e712 nixos/mysql: move ExecStartPost into postStart 2020-08-13 17:03:22 -04:00
Aaron Andersen e3c210dfd1 nixos/mysql: run ExecStartPost as an unprivileged user 2020-08-12 07:21:27 -04:00
Aaron Andersen 31098a03a2 nixos/mysql: cleanup some descriptions 2020-08-12 07:11:00 -04:00
Aaron Andersen ff9921f0fd nixos/mysql: loosen mariadb check 2020-08-12 07:10:59 -04:00
Aaron Andersen 3792fef4ec nixos/mysql: add group option 2020-08-12 07:10:56 -04:00
Aaron Andersen 9b56677634 nixos/mysql: remove variable with confusing name 2020-08-11 21:09:41 -04:00
Izorkin eed170d9ab nixos/mysql: fix init databases on first start in sandbox mode 2020-06-10 12:38:42 +03:00
Izorkin a9d5f088b5 nixos/mysql: update tmpfiles rules 2020-06-10 12:38:42 +03:00
Izorkin df7e52814d nixos/mysql: enable sandbox mode 2020-06-10 12:38:40 +03:00
Michele Guerini Rocco 429f976089
Merge pull request #87812 from joachimschmidt557/mysql-enable-option
nixos/mysql: refactor enable option
2020-05-28 10:02:25 +02:00
Izorkin da08b22e1a nixos/mysql-replication: ignore system databases in binary log 2020-05-14 17:29:40 +03:00
Izorkin b8c8e810aa nixos/mysql: disable load pluginx auth_socket in mariadb 2020-05-14 17:29:40 +03:00
joachimschmidt557 cd1152ff7c nixos/mysql: refactor enable option 2020-05-14 13:08:41 +02:00
Aaron Andersen 3474b55614 nixos/mysql: fix service so it works with mysql80 package 2020-03-20 20:54:17 -04:00
Aaron Andersen 641b94bdd0 nixos/mysql: add settings and configFile options 2020-03-10 15:15:11 -04:00
Aaron Andersen df059f89e6 nixos/mysql: restart systemd service on abort 2020-01-06 20:08:51 -05:00