nixos/wordpress: Add language support

This commit is contained in:
Jonas Heinrich 2022-09-13 17:17:26 +02:00 committed by Yt
parent 7f3b66af6d
commit b881869205
3 changed files with 37 additions and 1 deletions

View file

@ -767,6 +767,13 @@
grants access to the hardware.
</para>
</listitem>
<listitem>
<para>
The Wordpress module got support for installing language packs
through
<literal>services.wordpress.sites.&lt;site&gt;.languages</literal>.
</para>
</listitem>
<listitem>
<para>
There is a new module for the <literal>thunar</literal>

View file

@ -254,6 +254,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
- There is a new module for AMD SEV CPU functionality, which grants access to the hardware.
- The Wordpress module got support for installing language packs through `services.wordpress.sites.<site>.languages`.
- There is a new module for the `thunar` program (the Xfce file manager), which depends on the `xfconf` dbus service, and also has a dbus service and a systemd unit. The option `services.xserver.desktopManager.xfce.thunarPlugins` has been renamed to `programs.thunar.plugins`, and in a future release it may be removed.
- There is a new module for the `xfconf` program (the Xfce configuration storage system), which has a dbus service.

View file

@ -30,9 +30,10 @@ let
# requests that look like: https://example.com/wp-content//nix/store/...plugin/path/some-file.js
# Since hard linking directories is not allowed, copying is the next best thing.
# copy additional plugin(s) and theme(s)
# copy additional plugin(s), theme(s) and language(s)
${concatMapStringsSep "\n" (theme: "cp -r ${theme} $out/share/wordpress/wp-content/themes/${theme.name}") cfg.themes}
${concatMapStringsSep "\n" (plugin: "cp -r ${plugin} $out/share/wordpress/wp-content/plugins/${plugin.name}") cfg.plugins}
${concatMapStringsSep "\n" (language: "cp -r ${language} $out/share/wordpress/wp-content/languages/") cfg.languages}
'';
};
@ -154,6 +155,32 @@ let
'';
};
languages = mkOption {
type = types.listOf types.path;
default = [];
description = lib.mdDoc ''
List of path(s) to respective language(s) which are copied from the 'languages' directory.
'';
example = literalExpression ''
[(
# Let's package the German language.
# For other languages try to replace language and country code in the download URL with your desired one.
# Reference https://translate.wordpress.org for available translations and
# codes.
language-de = pkgs.stdenv.mkDerivation {
name = "language-de";
src = pkgs.fetchurl {
url = "https://de.wordpress.org/wordpress-''${pkgs.wordpress.version}-de_DE.tar.gz";
# Name is required to invalidate the hash when wordpress is updated
name = "wordpress-''${pkgs.wordpress.version}-language-de"
sha256 = "sha256-dlas0rXTSV4JAl8f/UyMbig57yURRYRhTMtJwF9g8h0=";
};
installPhase = "mkdir -p $out; cp -r ./wp-content/languages/* $out/";
};
)];
'';
};
database = {
host = mkOption {
type = types.str;