nixos/redmine: replace extraConfig option with settings option
This commit is contained in:
parent
bd37bc58f9
commit
dee97b8b44
@ -1,12 +1,12 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkDefault mkEnableOption mkIf mkOption types;
|
inherit (lib) mkDefault mkEnableOption mkIf mkOption mkRemovedOptionModule types;
|
||||||
inherit (lib) concatStringsSep literalExample mapAttrsToList;
|
inherit (lib) concatStringsSep literalExample mapAttrsToList;
|
||||||
inherit (lib) optional optionalAttrs optionalString singleton versionAtLeast;
|
inherit (lib) optional optionalAttrs optionalString;
|
||||||
|
|
||||||
cfg = config.services.redmine;
|
cfg = config.services.redmine;
|
||||||
|
format = pkgs.formats.yaml {};
|
||||||
bundle = "${cfg.package}/share/redmine/bin/bundle";
|
bundle = "${cfg.package}/share/redmine/bin/bundle";
|
||||||
|
|
||||||
databaseYml = pkgs.writeText "database.yml" ''
|
databaseYml = pkgs.writeText "database.yml" ''
|
||||||
@ -20,17 +20,7 @@ let
|
|||||||
${optionalString (cfg.database.type == "mysql2" && cfg.database.socket != null) "socket: ${cfg.database.socket}"}
|
${optionalString (cfg.database.type == "mysql2" && cfg.database.socket != null) "socket: ${cfg.database.socket}"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurationYml = pkgs.writeText "configuration.yml" ''
|
configurationYml = format.generate "configuration.yml" cfg.settings;
|
||||||
default:
|
|
||||||
scm_subversion_command: ${pkgs.subversion}/bin/svn
|
|
||||||
scm_mercurial_command: ${pkgs.mercurial}/bin/hg
|
|
||||||
scm_git_command: ${pkgs.gitAndTools.git}/bin/git
|
|
||||||
scm_cvs_command: ${pkgs.cvs}/bin/cvs
|
|
||||||
scm_bazaar_command: ${pkgs.breezy}/bin/bzr
|
|
||||||
scm_darcs_command: ${pkgs.darcs}/bin/darcs
|
|
||||||
|
|
||||||
${cfg.extraConfig}
|
|
||||||
'';
|
|
||||||
|
|
||||||
additionalEnvironment = pkgs.writeText "additional_environment.rb" ''
|
additionalEnvironment = pkgs.writeText "additional_environment.rb" ''
|
||||||
config.logger = Logger.new("${cfg.stateDir}/log/production.log", 14, 1048576)
|
config.logger = Logger.new("${cfg.stateDir}/log/production.log", 14, 1048576)
|
||||||
@ -56,8 +46,12 @@ let
|
|||||||
pgsqlLocal = cfg.database.createLocally && cfg.database.type == "postgresql";
|
pgsqlLocal = cfg.database.createLocally && cfg.database.type == "postgresql";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule [ "services" "redmine" "extraConfig" ] "Use services.redmine.settings instead.")
|
||||||
|
];
|
||||||
|
|
||||||
|
# interface
|
||||||
options = {
|
options = {
|
||||||
services.redmine = {
|
services.redmine = {
|
||||||
enable = mkEnableOption "Redmine";
|
enable = mkEnableOption "Redmine";
|
||||||
@ -93,21 +87,24 @@ in
|
|||||||
description = "The state directory, logs and plugins are stored here.";
|
description = "The state directory, logs and plugins are stored here.";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
settings = mkOption {
|
||||||
type = types.lines;
|
type = format.type;
|
||||||
default = "";
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Extra configuration in configuration.yml.
|
Redmine configuration (<filename>configuration.yml</filename>). Refer to
|
||||||
|
<link xlink:href="https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration"/>
|
||||||
See <link xlink:href="https://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration"/>
|
|
||||||
for details.
|
for details.
|
||||||
'';
|
'';
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
email_delivery:
|
{
|
||||||
delivery_method: smtp
|
email_delivery = {
|
||||||
smtp_settings:
|
delivery_method = "smtp";
|
||||||
address: mail.example.com
|
smtp_settings = {
|
||||||
port: 25
|
address = "mail.example.com";
|
||||||
|
port = 25;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -226,6 +223,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# implementation
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
assertions = [
|
assertions = [
|
||||||
@ -243,6 +241,17 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.redmine.settings = {
|
||||||
|
production = {
|
||||||
|
scm_subversion_command = "${pkgs.subversion}/bin/svn";
|
||||||
|
scm_mercurial_command = "${pkgs.mercurial}/bin/hg";
|
||||||
|
scm_git_command = "${pkgs.gitAndTools.git}/bin/git";
|
||||||
|
scm_cvs_command = "${pkgs.cvs}/bin/cvs";
|
||||||
|
scm_bazaar_command = "${pkgs.breezy}/bin/bzr";
|
||||||
|
scm_darcs_command = "${pkgs.darcs}/bin/darcs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.mysql = mkIf mysqlLocal {
|
services.mysql = mkIf mysqlLocal {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = mkDefault pkgs.mariadb;
|
package = mkDefault pkgs.mariadb;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user