diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-11-20 17:41:38 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-11-20 19:12:14 +0300 |
commit | 6bb292d42b60ec78e92836c33d6f0b270d760e84 (patch) | |
tree | 259f88e86238eab503bf5469e9b6ad70c51e0283 | |
parent | 5bfaa2d3ad5947730ad28e26622c8c49b45ba609 (diff) | |
download | nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar.gz nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar.bz2 nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar.lz nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar.xz nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.tar.zst nixpkgs-6bb292d42b60ec78e92836c33d6f0b270d760e84.zip |
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.
-rw-r--r-- | nixos/doc/manual/release-notes/rl-1703.xml | 9 | ||||
-rw-r--r-- | nixos/modules/rename.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/misc/parsoid.nix | 37 |
3 files changed, 31 insertions, 18 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1703.xml b/nixos/doc/manual/release-notes/rl-1703.xml index 743f3dce230..a133630e146 100644 --- a/nixos/doc/manual/release-notes/rl-1703.xml +++ b/nixos/doc/manual/release-notes/rl-1703.xml @@ -68,6 +68,15 @@ following incompatible changes:</para> 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> diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 0d2e0f981db..81b197186c4 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -144,6 +144,9 @@ with lib; # 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" ] "") diff --git a/nixos/modules/services/misc/parsoid.nix b/nixos/modules/services/misc/parsoid.nix index ab1b5406877..ae3f84333d2 100644 --- a/nixos/modules/services/misc/parsoid.nix +++ b/nixos/modules/services/misc/parsoid.nix @@ -6,20 +6,21 @@ let cfg = config.services.parsoid; - conf = '' - exports.setup = function( parsoidConfig ) { - ${toString (mapAttrsToList (name: str: "parsoidConfig.setInterwiki('${name}', '${str}');") cfg.interwikis)} - - parsoidConfig.serverInterface = "${cfg.interface}"; - parsoidConfig.serverPort = ${toString cfg.port}; - - parsoidConfig.useSelser = true; - - ${cfg.extraConfig} - }; - ''; + 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; + }; + }]; + }; - confFile = builtins.toFile "localsettings.js" conf; + confFile = pkgs.writeText "config.yml" (builtins.toJSON (recursiveUpdate confTree cfg.extraConfig)); in { @@ -38,9 +39,9 @@ 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. ''; @@ -71,8 +72,8 @@ in }; extraConfig = mkOption { - type = types.lines; - default = ""; + type = types.attrs; + default = {}; description = '' Extra configuration to add to parsoid configuration. ''; |