nixos/wordpress: Drop old deprecated interface (#152674)

Changed files
+35 -41
nixos
doc
manual
from_md
release-notes
release-notes
modules
services
web-apps
tests
+8
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
···
<listitem>
<para>
The backward compatibility in
+
<literal>services.wordpress</literal> to configure sites with
+
the old interface has been removed. Please use
+
<literal>services.wordpress.sites</literal> instead.
+
</para>
+
</listitem>
+
<listitem>
+
<para>
+
The backward compatibility in
<literal>services.dokuwiki</literal> to configure sites with
the old interface has been removed. Please use
<literal>services.dokuwiki.sites</literal> instead.
+4
nixos/doc/manual/release-notes/rl-2205.section.md
···
- If you previously used `/etc/docker/daemon.json`, you need to incorporate the changes into the new option `virtualisation.docker.daemon.settings`.
+
- The backward compatibility in `services.wordpress` to configure sites with
+
the old interface has been removed. Please use `services.wordpress.sites`
+
instead.
+
- The backward compatibility in `services.dokuwiki` to configure sites with the
old interface has been removed. Please use `services.dokuwiki.sites` instead.
+20 -35
nixos/modules/services/web-apps/wordpress.nix
···
{ config, pkgs, lib, ... }:
-
let
-
inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption types;
-
inherit (lib) any attrValues concatMapStringsSep flatten literalExpression;
-
inherit (lib) filterAttrs mapAttrs mapAttrs' mapAttrsToList nameValuePair optional optionalAttrs optionalString;
+
with lib;
-
cfg = migrateOldAttrs config.services.wordpress;
+
let
+
cfg = config.services.wordpress;
eachSite = cfg.sites;
user = "wordpress";
webserver = config.services.${cfg.webserver};
stateDir = hostName: "/var/lib/wordpress/${hostName}";
-
-
# Migrate config.services.wordpress.<hostName> to config.services.wordpress.sites.<hostName>
-
oldSites = filterAttrs (o: _: o != "sites" && o != "webserver");
-
migrateOldAttrs = cfg: cfg // { sites = cfg.sites // oldSites cfg; };
pkg = hostName: cfg: pkgs.stdenv.mkDerivation rec {
pname = "wordpress-${hostName}";
···
{
# interface
options = {
-
services.wordpress = mkOption {
-
type = types.submodule {
-
# Used to support old interface
-
freeformType = types.attrsOf (types.submodule siteOpts);
+
services.wordpress = {
-
# New interface
-
options.sites = mkOption {
-
type = types.attrsOf (types.submodule siteOpts);
-
default = {};
-
description = "Specification of one or more WordPress sites to serve";
-
};
+
sites = mkOption {
+
type = types.attrsOf (types.submodule siteOpts);
+
default = {};
+
description = "Specification of one or more WordPress sites to serve";
+
};
-
options.webserver = mkOption {
-
type = types.enum [ "httpd" "nginx" "caddy" ];
-
default = "httpd";
-
description = ''
-
Whether to use apache2 or nginx for virtual host management.
+
webserver = mkOption {
+
type = types.enum [ "httpd" "nginx" "caddy" ];
+
default = "httpd";
+
description = ''
+
Whether to use apache2 or nginx for virtual host management.
-
Further nginx configuration can be done by adapting <literal>services.nginx.virtualHosts.&lt;name&gt;</literal>.
-
See <xref linkend="opt-services.nginx.virtualHosts"/> for further information.
+
Further nginx configuration can be done by adapting <literal>services.nginx.virtualHosts.&lt;name&gt;</literal>.
+
See <xref linkend="opt-services.nginx.virtualHosts"/> for further information.
-
Further apache2 configuration can be done by adapting <literal>services.httpd.virtualHosts.&lt;name&gt;</literal>.
-
See <xref linkend="opt-services.httpd.virtualHosts"/> for further information.
-
'';
-
};
+
Further apache2 configuration can be done by adapting <literal>services.httpd.virtualHosts.&lt;name&gt;</literal>.
+
See <xref linkend="opt-services.httpd.virtualHosts"/> for further information.
+
'';
};
-
default = {};
-
description = "Wordpress configuration";
-
};
+
};
};
# implementation
···
message = ''services.wordpress.sites."${hostName}".database.passwordFile cannot be specified if services.wordpress.sites."${hostName}".database.createLocally is set to true.'';
}) eachSite);
-
-
warnings = mapAttrsToList (hostName: _: ''services.wordpress."${hostName}" is deprecated use services.wordpress.sites."${hostName}"'') (oldSites cfg);
services.mysql = mkIf (any (v: v.database.createLocally) (attrValues eachSite)) {
enable = true;
+3 -6
nixos/tests/wordpress.nix
···
services.httpd.adminAddr = "webmaster@site.local";
services.httpd.logPerVirtualHost = true;
-
services.wordpress = {
-
# Test support for old interface
+
services.wordpress.sites = {
"site1.local" = {
database.tablePrefix = "site1_";
};
-
sites = {
-
"site2.local" = {
-
database.tablePrefix = "site2_";
-
};
+
"site2.local" = {
+
database.tablePrefix = "site2_";
};
};