parsoid service: update, use declarative configuration

Old configuration format is disabled now (it can still be used, but with
additional steps). This is a backwards incompatible change.

Changed files
+31 -18
nixos
doc
manual
release-notes
modules
services
+9
nixos/doc/manual/release-notes/rl-1703.xml
···
that may be in /etc.
</para>
</listitem>
+
+
<listitem>
+
<para>
+
Parsoid service now uses YAML configuration format.
+
<literal>service.parsoid.interwikis</literal> is now called
+
<literal>service.parsoid.wikis</literal> and is a list of either API URLs
+
or attribute sets as specified in parsoid's documentation.
+
</para>
+
</listitem>
</itemizedlist>
+3
nixos/modules/rename.nix
···
# murmur
(mkRenamedOptionModule [ "services" "murmur" "welcome" ] [ "services" "murmur" "welcometext" ])
+
# parsoid
+
(mkRemovedOptionModule [ "services" "parsoid" "interwikis" ] [ "services" "parsoid" "wikis" ])
+
# Options that are obsolete and have no replacement.
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
+19 -18
nixos/modules/services/misc/parsoid.nix
···
cfg = config.services.parsoid;
-
conf = ''
-
exports.setup = function( parsoidConfig ) {
-
${toString (mapAttrsToList (name: str: "parsoidConfig.setInterwiki('${name}', '${str}');") cfg.interwikis)}
+
confTree = {
+
worker_heartbeat_timeout = 300000;
+
logging = { level = "info"; };
+
services = [{
+
module = "lib/index.js";
+
entrypoint = "apiServiceWorker";
+
conf = {
+
mwApis = map (x: if isAttrs x then x else { uri = x; }) cfg.wikis;
+
serverInterface = cfg.interface;
+
serverPort = cfg.port;
+
};
+
}];
+
};
-
parsoidConfig.serverInterface = "${cfg.interface}";
-
parsoidConfig.serverPort = ${toString cfg.port};
-
-
parsoidConfig.useSelser = true;
-
-
${cfg.extraConfig}
-
};
-
'';
-
-
confFile = builtins.toFile "localsettings.js" conf;
+
confFile = pkgs.writeText "config.yml" (builtins.toJSON (recursiveUpdate confTree cfg.extraConfig));
in
{
···
'';
};
-
interwikis = mkOption {
-
type = types.attrsOf types.str;
-
example = { localhost = "http://localhost/api.php"; };
+
wikis = mkOption {
+
type = types.listOf (types.either types.str types.attrs);
+
example = [ "http://localhost/api.php" ];
description = ''
Used MediaWiki API endpoints.
'';
···
};
extraConfig = mkOption {
-
type = types.lines;
-
default = "";
+
type = types.attrs;
+
default = {};
description = ''
Extra configuration to add to parsoid configuration.
'';