mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-22 20:14:37 +00:00
Merge pull request #210686 from urandom2/wordpress2
nixos/wordpress: plugins and themes as attrs
This commit is contained in:
commit
7a60b737d2
@ -352,6 +352,17 @@
|
||||
updated manually.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The
|
||||
<link linkend="opt-services.wordpress.sites._name_.plugins">services.wordpress.sites.<name>.plugins</link>
|
||||
and
|
||||
<link linkend="opt-services.wordpress.sites._name_.themes">services.wordpress.sites.<name>.themes</link>
|
||||
options have been converted from sets to attribute sets to
|
||||
allow for consumers to specify explicit install paths via
|
||||
attribute name.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
In <literal>mastodon</literal> it is now necessary to specify
|
||||
|
@ -87,6 +87,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||
|
||||
- Qt 5.12 and 5.14 have been removed, as the corresponding branches have been EOL upstream for a long time. This affected under 10 packages in nixpkgs, largely unmaintained upstream as well, however, out-of-tree package expressions may need to be updated manually.
|
||||
|
||||
- The [services.wordpress.sites.<name>.plugins](#opt-services.wordpress.sites._name_.plugins) and [services.wordpress.sites.<name>.themes](#opt-services.wordpress.sites._name_.themes) options have been converted from sets to attribute sets to allow for consumers to specify explicit install paths via attribute name.
|
||||
|
||||
- In `mastodon` it is now necessary to specify location of file with `PostgreSQL` database password. In `services.mastodon.database.passwordFile` parameter default value `/var/lib/mastodon/secrets/db-password` has been changed to `null`.
|
||||
|
||||
- The `--target-host` and `--build-host` options of `nixos-rebuild` no longer treat the `localhost` value specially – to build on/deploy to local machine, omit the relevant flag.
|
||||
|
@ -32,8 +32,8 @@ let
|
||||
# Since hard linking directories is not allowed, copying is the next best thing.
|
||||
|
||||
# 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}
|
||||
${concatStringsSep "\n" (mapAttrsToList (name: theme: "cp -r ${theme} $out/share/wordpress/wp-content/themes/${name}") cfg.themes)}
|
||||
${concatStringsSep "\n" (mapAttrsToList (name: plugin: "cp -r ${plugin} $out/share/wordpress/wp-content/plugins/${name}") cfg.plugins)}
|
||||
${concatMapStringsSep "\n" (language: "cp -r ${language} $out/share/wordpress/wp-content/languages/") cfg.languages}
|
||||
'';
|
||||
};
|
||||
@ -130,62 +130,44 @@ let
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.path;
|
||||
default = [];
|
||||
type = with types; coercedTo
|
||||
(listOf path)
|
||||
(l: warn "setting this option with a list is deprecated"
|
||||
listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l))
|
||||
(attrsOf path);
|
||||
default = {};
|
||||
description = lib.mdDoc ''
|
||||
List of path(s) to respective plugin(s) which are copied from the 'plugins' directory.
|
||||
Path(s) to respective plugin(s) which are copied from the 'plugins' directory.
|
||||
|
||||
::: {.note}
|
||||
These plugins need to be packaged before use, see example.
|
||||
:::
|
||||
'';
|
||||
example = literalExpression ''
|
||||
let
|
||||
# Wordpress plugin 'embed-pdf-viewer' installation example
|
||||
embedPdfViewerPlugin = pkgs.stdenv.mkDerivation {
|
||||
name = "embed-pdf-viewer-plugin";
|
||||
# Download the theme from the wordpress site
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://downloads.wordpress.org/plugin/embed-pdf-viewer.2.0.3.zip";
|
||||
sha256 = "1rhba5h5fjlhy8p05zf0p14c9iagfh96y91r36ni0rmk6y891lyd";
|
||||
};
|
||||
# We need unzip to build this package
|
||||
nativeBuildInputs = [ pkgs.unzip ];
|
||||
# Installing simply means copying all files to the output directory
|
||||
installPhase = "mkdir -p $out; cp -R * $out/";
|
||||
};
|
||||
# And then pass this theme to the themes list like this:
|
||||
in [ embedPdfViewerPlugin ]
|
||||
{
|
||||
inherit (pkgs.wordpressPackages.plugins) embed-pdf-viewer-plugin;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
themes = mkOption {
|
||||
type = types.listOf types.path;
|
||||
default = [];
|
||||
type = with types; coercedTo
|
||||
(listOf path)
|
||||
(l: warn "setting this option with a list is deprecated"
|
||||
listToAttrs (map (p: nameValuePair (p.name or (throw "${p} does not have a name")) p) l))
|
||||
(attrsOf path);
|
||||
default = {};
|
||||
description = lib.mdDoc ''
|
||||
List of path(s) to respective theme(s) which are copied from the 'theme' directory.
|
||||
Path(s) to respective theme(s) which are copied from the 'theme' directory.
|
||||
|
||||
::: {.note}
|
||||
These themes need to be packaged before use, see example.
|
||||
:::
|
||||
'';
|
||||
example = literalExpression ''
|
||||
let
|
||||
# Let's package the responsive theme
|
||||
responsiveTheme = pkgs.stdenv.mkDerivation {
|
||||
name = "responsive-theme";
|
||||
# Download the theme from the wordpress site
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://downloads.wordpress.org/theme/responsive.3.14.zip";
|
||||
sha256 = "0rjwm811f4aa4q43r77zxlpklyb85q08f9c8ns2akcarrvj5ydx3";
|
||||
};
|
||||
# We need unzip to build this package
|
||||
nativeBuildInputs = [ pkgs.unzip ];
|
||||
# Installing simply means copying all files to the output directory
|
||||
installPhase = "mkdir -p $out; cp -R * $out/";
|
||||
};
|
||||
# And then pass this theme to the themes list like this:
|
||||
in [ responsiveTheme ]
|
||||
{
|
||||
inherit (pkgs.wordpressPackages.themes) responsive-theme;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user