Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wordpress: packages for plugins and themes #124383

Closed
wants to merge 2 commits into from
Closed

Conversation

onny
Copy link
Contributor

@onny onny commented May 25, 2021

Motivation for this change

I packaged some Wordpress themes and plugins in the subset wordpressPackages.plugins and wordpressPackages.themes. These packages can be used in a Wordpress installation like this:

services.wordpress = {
  webserver = "caddy";
  sites."blog.${config.networking.domain}" = {
    plugins = with wordpressPackages.plugins; [
      anti-spam-bee
      code-syntax-block
      lightbox-with-photoswipe
      wp-gdpr-compliance
    ];
    themes = [ wordpressPackages.themes.geist ];
  };
};
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Added a release notes entry if the change is major or breaking
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 25, 2021
@onny onny requested a review from basvandijk May 25, 2021 14:04
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 11-100 and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 25, 2021
@ajs124
Copy link
Member

ajs124 commented May 25, 2021

#96910

@onny
Copy link
Contributor Author

onny commented May 25, 2021

#96910

Oh I wasn't aware of wp4nix. Is this something we could get merged into nixpkgs? Would be cool to have Wordpress packages in there too.

@r-rmcgibbo
Copy link

Result of nixpkgs-review pr 124383 at 1758c90 run on x86_64-linux 1

1 package failed to build:
14 packages built successfully:
  • wordpressPlugins.anti-spam-bee
  • wordpressPlugins.async-javascript
  • wordpressPlugins.breeze
  • wordpressPlugins.co-authors-plus
  • wordpressPlugins.code-syntax-block
  • wordpressPlugins.disable-xml-rpc
  • wordpressPlugins.jetpack
  • wordpressPlugins.lightbox-with-photoswipe
  • wordpressPlugins.opengraph
  • wordpressPlugins.simple-login-captcha
  • wordpressPlugins.wp-gdpr-compliance
  • wordpressPlugins.wp-statistics
  • wordpressPlugins.wp-user-avatar
  • wordpressThemes.geist
29 suggestions:
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:127:5:

        |
    127 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: maintainers-missing

    Package does not have a maintainer. Consider adding yourself?

    Near pkgs/servers/web-apps/wordpress/plugins.nix:25:14:

       |
    25 |       inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:83:5:

       |
    83 |     buildInputs = [ pkgs.unzip pkgs.php ];
       |     ^
    
  • warning: missing-phase-hooks

    installPhase should probably contain runHook preInstall and runHook postInstall.

    Near pkgs/servers/web-apps/wordpress/themes.nix:27:7:

       |
    27 |       installPhase = "mkdir -p $out; cp -R * $out/";
       |       ^
    
  • warning: missing-phase-hooks

    configurePhase should probably contain runHook preConfigure and runHook postConfigure.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:25:14:

       |
    25 |       inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:105:5:

        |
    105 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: unused-argument

    Unused argument: path.
    Near pkgs/servers/web-apps/wordpress/themes.nix:19:5:

       |
    19 |     path ? lib.getName themeName,
       |     ^
    
  • warning: license-missing

    Package is missing a license.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:25:14:

       |
    25 |       inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:182:5:

        |
    182 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:138:5:

        |
    138 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: license-missing

    Package is missing a license.

    Near pkgs/servers/web-apps/wordpress/themes.nix:25:14:

       |
    25 |       inherit themeName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:61:5:

       |
    61 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:94:5:

       |
    94 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: missing-phase-hooks

    buildPhase should probably contain runHook preBuild and runHook postBuild.

    Near pkgs/servers/web-apps/wordpress/themes.nix:25:14:

       |
    25 |       inherit themeName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:171:5:

        |
    171 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:149:5:

        |
    149 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: missing-phase-hooks

    buildPhase should probably contain runHook preBuild and runHook postBuild.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:25:14:

       |
    25 |       inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: unused-argument

    Unused argument: src.
    Near pkgs/servers/web-apps/wordpress/themes.nix:12:5:

       |
    12 |     src,
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:40:5:

       |
    40 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:160:5:

        |
    160 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: unused-argument

    Unused argument: src.
    Near pkgs/servers/web-apps/wordpress/plugins.nix:12:5:

       |
    12 |     src,
       |     ^
    
  • warning: missing-phase-hooks

    installPhase should probably contain runHook preInstall and runHook postInstall.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:27:7:

       |
    27 |       installPhase = "mkdir -p $out; cp -R * $out/";
       |       ^
    
  • warning: missing-phase-hooks

    configurePhase should probably contain runHook preConfigure and runHook postConfigure.

    Near pkgs/servers/web-apps/wordpress/themes.nix:25:14:

       |
    25 |       inherit themeName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:72:5:

       |
    72 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:50:5:

       |
    50 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/plugins.nix:116:5:

        |
    116 |     buildInputs = [ pkgs.unzip ];
        |     ^
    
  • warning: unused-argument

    Unused argument: path.
    Near pkgs/servers/web-apps/wordpress/plugins.nix:19:5:

       |
    19 |     path ? lib.getName pluginName,
       |     ^
    
  • warning: build-tools-in-build-inputs

    unzip is a build tool so it likely goes to nativeBuildInputs, not buildInputs.

    Near pkgs/servers/web-apps/wordpress/themes.nix:40:5:

       |
    40 |     buildInputs = [ pkgs.unzip ];
       |     ^
    
  • warning: maintainers-missing

    Package does not have a maintainer. Consider adding yourself?

    Near pkgs/servers/web-apps/wordpress/themes.nix:25:14:

       |
    25 |       inherit themeName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
       |              ^
    

Note that build failures may predate this PR, and could be nondeterministic or hardware dependent.
Please exercise your independent judgement. Does something look off? Please file an issue or reach out on IRC.

@ofborg ofborg bot added 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux and removed 10.rebuild-linux: 11-100 labels May 26, 2021
@onny
Copy link
Contributor Author

onny commented May 26, 2021

I changed the package attributes according to wp4nix:

nix-shell -p wordpressPackages.plugins.jetpack

and for themes:

nix-shell -p wordpressPackages.themes.geist

Most of the plugins and themes have version tags so that the zip download url is fixed to a specific version.

@ajs124 @mohe2015 The pull request mentioned above looks interesting. It addresses several issues and contains breaking changes, so it's a bigger thing and maybe not so easy to merge? In how far does it relate to packaging of plugins and themes?

@ajs124
Copy link
Member

ajs124 commented May 26, 2021

Most of the plugins and themes have version tags so that the zip download url is fixed to a specific version.

People republish these versions by pushing to the same subversion tag regularly.

@mohe2015
Copy link
Contributor

mohe2015 commented May 26, 2021

@onny

Most of the plugins and themes have version tags so that the zip download url is fixed to a specific version.

This was actually a problem we faced because the plugins can update their contents without updating the version. This is one reason ajs124 wrote the script that downloads them from svn.

ajs124 mohe2015 The pull request mentioned above looks interesting. It addresses several issues and contains breaking changes, so it's a bigger thing and maybe not so easy to merge?

I'm currently waiting for #84446 to get merged and would probably try again to get it merged then.
The first three commits are easy improvements and should be fairly easy to get merged.
Changing the default database name makes it easier to create multiple wordpress services but is a breaking change (well stateVersion).
Changing the prefix of the apache service name is not required but may be benefical. Unfortunately this would break with the nginx PR so maybe I should think about it now. (EDIT: I commented there)
Removing the version from the theme folder name is probably the most important change as otherwise wordpress is almost unusable if a theme doesn't store the settings in a way this doesn't break. But this is also a breaking change which is unfortunate.
Allowing a mutable wp-content directory is mostly convenience for testing new plugins and themes or using plugins that don't work with the non-writable approach but then you loose most benefits of the module anyways.
I also added some documentation for changing the hostname but this is also terribly supported by wordpress itself so it's only a documentation change but I would still avoid it if possible.

To conclude yes it's not easy to merge because of the many changes and because of the breaking changes.

As ajs124 just said plugin and theme versions are not immutable. Also it's way easier to just use an automatic tool to package and update these.

In how far does it relate to packaging of plugins and themes?

The main change is the change of the directory names for plugins and themes. Other than that I would strongly recommend to use something like wp4nix (possibly with flakes) and not packaging manually at all. Adding wordpress-core relates to packaging plugins as this allows you to update the builtin plugins and themes independently of the wordpress version (and more often)

Edit: Maybe I will split up my PR

@onny onny closed this Dec 4, 2021
@onny onny deleted the wordpress branch December 4, 2021 17:50
@onny onny mentioned this pull request May 19, 2022
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants