From a6196bc8b20472cd49fc55ca43c7be9dcc7cb624 Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 8 Dec 2021 16:57:00 +0000 Subject: [PATCH] couchdb3: add vm.args and fix pkgs.couchdb reference --- nixos/modules/services/databases/couchdb.nix | 16 +++++++++++++--- nixos/tests/couchdb.nix | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/databases/couchdb.nix b/nixos/modules/services/databases/couchdb.nix index 16dd64f2373e..266bc82b6967 100644 --- a/nixos/modules/services/databases/couchdb.nix +++ b/nixos/modules/services/databases/couchdb.nix @@ -43,8 +43,8 @@ in { package = mkOption { type = types.package; - default = pkgs.couchdb; - defaultText = literalExpression "pkgs.couchdb"; + default = pkgs.couchdb3; + defaultText = literalExpression "pkgs.couchdb3"; description = '' CouchDB package to use. ''; @@ -150,6 +150,14 @@ in { ''; }; + argsFile = mkOption { + type = types.path; + default = "${cfg.package}/etc/vm.args"; + description = '' + vm.args configuration. Overrides Couchdb's Erlang VM parameters file. + ''; + }; + configFile = mkOption { type = types.path; description = '' @@ -186,12 +194,14 @@ in { ''; environment = { - # we are actually specifying 4 configuration files: + # we are actually specifying 5 configuration files: # 1. the preinstalled default.ini # 2. the module configuration # 3. the extraConfig from the module options # 4. the locally writable config file, which couchdb itself writes to ERL_FLAGS= ''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} ${cfg.configFile}''; + # 5. the vm.args file + COUCHDB_ARGS_FILE=''${cfg.argsFile}''; }; serviceConfig = { diff --git a/nixos/tests/couchdb.nix b/nixos/tests/couchdb.nix index 049532481b15..453f5dcd66e8 100644 --- a/nixos/tests/couchdb.nix +++ b/nixos/tests/couchdb.nix @@ -56,5 +56,8 @@ with lib; couchdb3.succeed( "${curlJqCheck testlogin "GET" "_all_dbs" ". | length" "0"}" ) + couchdb3.succeed( + "${curlJqCheck testlogin "GET" "_node/couchdb@127.0.0.1" ".couchdb" "Welcome"}" + ) ''; })