Commit Graph

50 Commits

Author SHA1 Message Date
ajs124
02ad3159b0 ruby_2_7: remove 2024-01-02 15:30:06 +01:00
Nick Cao
c0443ea94c
Merge pull request #271869 from wentasah/redmine-assertions
nixos/redmine: Fix database assertions
2023-12-04 08:56:45 -05:00
Michal Sojka
8667baf161 nixos/redmine: Fix database assertions
Recent PR 266270[1] modified an assertion related to database settings
of the redmine service. There are two problems with that change:

1. Assert message was not updated to reflect the change in the assert
   condition.

2. The new condition applies only to postgresql, not the default
   mysql. Therefore, the assertion breaks existing mysql-based
   installations without any reason.

This commit fixes these by 1) reverting the modified assertion to the
previous value, making the message match the condition and 2) adding a
new assertion that applies only to postgresql.

[1]: https://github.com/NixOS/nixpkgs/pull/266270
2023-12-03 14:41:42 +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
Meghea Iulian
eb222f0f97
redmine: upgrade start command 2023-05-18 14:35:38 +03:00
Felix Buehler
327b0cff7a treewide: use more lib.optionalString 2023-04-07 13:38:33 +02:00
Ryan Lahfa
40b71c3e93
nixos/redmine: add missing lib.mdDoc (#203952) 2022-12-01 17:37:16 +01:00
Ryan Lahfa
78ef5b8663
Merge pull request #171930 from felixsinger/module/redmine/add-component-configs
nixos/redmine: Rework module
2022-12-01 15:35:08 +01:00
Daniel Nagy
095269c862
treewide: use types.port in nixos modules 2022-11-10 09:30:00 +01: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
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
Felix Singer
562bc5c2a9 nixos/redmine: Fix PNG generation of Gant diagrams
The Ruby gem `minimagick` is used to export Gant diagrams as PNG.
However, minimagick can't find a font and Redmine throws an error. The
setting `minimagick_font_path` allows configuring a path to a font file
in the Redmine configuration. Thus, add the option
`services.redmine.components.minimagick_font_path` allowing to do that.

Also, add an assertion to check if
`services.redmine.components.minimagick_font_path` is set when
imagemagick is enabled.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2022-05-15 01:47:23 +02:00
Felix Singer
66ef66fc62 nixos/redmine: Configure imagemagick_convert_command
For completeness, configure the setting `imagemagick_convert_command` in
the Redmine configuration file.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2022-05-15 01:47:04 +02:00
Felix Singer
4d23eae938 nixos/redmine: Add PDF export support for gant
Ghostscript is needed to export Gant diagrams as PDF. Thus, add the
option `services.redmine.components.ghostscript` allowing to enable or
disable the component. The component is disabled by default. Enabling
the option will add Ghostscript to the Redmine environment and configure
the setting `gs_command` in the Redmine configuration file.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2022-05-15 01:23:36 +02:00
Felix Singer
92b1cf8b4c nixos/redmine: Make optional components configurable
Currently, optional components and integrations of Redmine are enforced
to install in NixOS. Thus, add the following options allowing the users
to enable or disable the components. They are disabled by default.
Enabling these options will add their package to the Redmine environment
and will configure their specific setting in the Redmine configuration
file.

  * services.redmine.components.subversion
  * services.redmine.components.mercurial
  * services.redmine.components.git
  * services.redmine.components.cvs
  * services.redmine.components.breezy
  * services.redmine.components.imagemagick

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2022-05-15 01:22:49 +02:00
Felix Singer
3be58b2afc nixos/redmine: Drop darcs integration
darcs support was dropped with Redmine 4.0.0. Thus, drop the darcs
integration.

For more information, see https://www.redmine.org/issues/26391.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
2022-05-14 22:58:02 +02:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Daniel Nagy
bc87386ac1
nixos/redmine: use port type 2021-06-18 17:29:05 +02:00
Ben Siraphob
4f0cdb68d7 treewide: unzip buldInputs to nativeBuildInputs (2) 2021-03-06 15:18:05 +07:00
Alyssa Ross
3893d6c6d7 gitAndTools: move everything to the top level
The comment at the top of git-and-tools/default.nix said:

    /* All git-relates tools live here, in a separate attribute set so that users
     * can get a fast overview over what's available.

but unfortunately that hasn't actually held up in practice.

Git-related packages have continued to be added to the top level, or
into gitAndTools, or sometimes both, basically at random, so having
gitAndTools is just confusing.  In fact, until I looked as part of
working on getting rid of gitAndTools, one program (ydiff) was
packaged twice independently, once in gitAndTools and once at the top
level (I fixed this in 98c3490196).

So I think it's for the best if we move away from gitAndTools, and
just put all the packages it previously contained at the top level.
I've implemented this here by just making gitAndTools an alias for the
top level -- this saves having loads of lines in aliases.nix.  This
means that people can keep referring to gitAndTools in their
configuration, but it won't be allowed to be used within Nixpkgs, and
it won't be presented to new users by e.g. nix search.

The only other change here that I'm aware of is that
appendToName "minimal" is not longer called on the default git
package, because doing that would have necessitated having a private
gitBase variable like before.  I think it makes more sense not to do
that anyway, and reserve the "minimal" suffix only for gitMinimal.
2021-01-14 21:27:48 +00:00
Aaron Andersen
a7c69047df nixos/redmine: remove database.password option 2020-08-26 07:08:07 -04:00
Aaron Andersen
6cf743e52d nixos/redmine: allow user to override contents of additional_environment.rb 2020-08-26 07:08:07 -04:00
Aaron Andersen
dee97b8b44 nixos/redmine: replace extraConfig option with settings option 2020-08-26 07:08:07 -04:00
rnhmjoj
aee614c996
treewide: replace bazaar with breezy 2020-05-25 09:22:54 +02:00
Pavol Rusnak
fadcfc3ea4
treewide: per RFC45, remove more unquoted URLs 2020-04-18 14:04:37 +02:00
rnhmjoj
1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
zimbatm
ab64518d0f
nixos/redmine: update example to more recent Ruby 2020-01-01 00:27:14 +00:00
Aaron Andersen
50e5139893 redmine: drop 3.4.x package 2019-10-26 10:40:16 -04:00
Aaron Andersen
26a5f32096 nixos/redmine: cosmetic cleanup 2019-06-30 07:24:23 -04:00
Aaron Andersen
e702468f6b nixos/redmine: add database.createLocally option 2019-06-30 07:24:18 -04:00
aanderse
d800bd923f nixos/redmine: replace imagemagickBig with imagemagick (#57078) 2019-03-08 23:47:11 +01:00
Aaron Andersen
43258201b9 nixos/redmine: fix permissions & cleanup 2019-03-02 23:16:19 -05:00
aanderse
b8a9c3fbfd redmine: 3.4.8 -> 4.0.1 (#55234)
* redmine: 3.4.8 -> 4.0.1

* nixos/redmine: update nixos test to run against both redmine 3.x and 4.x series

* nixos/redmine: default new installs from 19.03 onward to redmine 4.x series, while keeping existing installs on redmine 3.x series

* nixos/redmine: add comment about default redmine package to 19.03 release notes

* redmine: add aandersea as a maintainer
2019-02-05 11:51:33 +00:00
Aaron Andersen
52bd7c5f2a nixos/redmine: add an extraEnv option (which could be used to turn on debug logging, etc...), enable automatic log rotation 2019-02-01 09:17:05 -05:00
Aaron Andersen
4ed7d822be redmine: add missing 'migrate' command prior to starting the application
required for plugins with a database component
see: http://www.redmine.org/projects/redmine/wiki/Plugins
2018-10-16 15:08:24 -04:00
Aaron Andersen
975f476cd2 quoting stateDir path in case it includes spaces 2018-10-11 08:04:47 -04:00
Aaron Andersen
1cb5b509f1 redmine: refactor, cleanup, bug fix, and add functionality
- added package option to specify which version of redmine
- added themes option back in to allow specifying redmine themes
- added plugins option back in to allow specifying redmine plugins
- added database.socket option to allow mysql unix socket authentication
- added port option to allow specifying the port rails runs on

- cleaned up Gemfile so it is much less hacky
- switched to ruby version 2.4 by default as suggested by documentation http://www.redmine.org/projects/redmine/wiki/redmineinstall#Installing-Redmine
- fixed an annoyance (bug) in the service causing recursive symlinks
- fixed ownership bug on log files generated by redmine
- updates reflecting renames in nixos options

- added a nixos test
2018-10-10 21:04:08 -04:00
Aaron Andersen
c93c0f3ae4 removed some local development stuff 2018-08-19 16:41:49 -04:00
Aaron Andersen
bb7568daf7 reworked the redmine service
added some security features like database.passwordFile
2018-08-19 16:29:44 -04:00
Aaron Andersen
5984ed283f started working on bringing the redmine package back to life using gitlab as an example 2018-08-19 08:09:38 -04:00
Florian Klink
fff5923686 nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
Robin Gloster
f5e0e94b2a
nixos/redmine: fix create role
postgresql create role no longer supports NOCREATEUSER option. See
https://www.postgresql.org/docs/9.6/static/release-9-6.html for
details.
2017-09-13 21:55:50 +02:00
Emery Hemingway
b675619391 nixos: use types.lines for extraConfig 2016-10-23 19:41:43 +02:00
Bjørn Forsman
2acf59efa4 nixos/redmine: improve assert message
Give the user more context.
2015-12-08 22:52:02 +01:00
Rok Garbas
d405d036c5 redmine service: fixing a typo, pointing to bundler package 2015-06-25 15:24:57 +02:00
Charles Strahan
94dd4b9721 ruby: WIP 2014-12-30 21:05:00 -05:00
Charles Strahan
4ed847d81d redmine: fix use of bundler 2014-12-28 14:22:11 -05:00
Charles Strahan
6e6ac35024 more rubyLibs renaming 2014-11-12 22:32:32 +00:00
Domen Kožar
b4a335cd59 nixos: add redmine service 2014-10-07 10:55:50 +02:00