WordPress: Difference between revisions
imported>Onny mNo edit summary |
imported>Onny Add note on plugin and themes packaging |
||
Line 59: | Line 59: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Hopefully Wordpress plugins and themes will also be packaged inside the Nixpkgs repository, see [https://github.com/NixOS/nixpkgs/pull/173622 this draft pull request]. | |||
[[Category:Services]] | [[Category:Services]] | ||
[[Category:Web Applications]] | [[Category:Web Applications]] |
Revision as of 15:17, 31 July 2022
Installation
A simple local setup of Wordpress can be enabled with the following setup
services.wordpress.sites."localhost".enabled = true;
Visit http://localhost to setup your new Wordpress instance. By default, a Mysql server is configured automatically so you won't have to setup the database backend.
Configuration
Plugins and themes
In case you want to package and add custom plugins and themes, you can add these too
let
# For shits and giggles, let's package the responsive theme
responsiveTheme = pkgs.stdenv.mkDerivation {
name = "responsive-theme";
# Download the theme from the wordpress site
src = pkgs.fetchurl {
url = http://wordpress.org/themes/download/responsive.1.9.7.6.zip;
sha256 = "06i26xlc5kdnx903b1gfvnysx49fb4kh4pixn89qii3a30fgd8r8";
};
# We need unzip to build this package
buildInputs = [ pkgs.unzip ];
# Installing simply means copying all files to the output directory
installPhase = "mkdir -p $out; cp -R * $out/";
};
# Wordpress plugin 'akismet' installation example
akismetPlugin = pkgs.stdenv.mkDerivation {
name = "akismet-plugin";
# Download the theme from the wordpress site
src = pkgs.fetchurl {
url = https://downloads.wordpress.org/plugin/akismet.3.1.zip;
sha256 = "1i4k7qyzna08822ncaz5l00wwxkwcdg4j9h3z2g0ay23q640pclg";
};
# We need unzip to build this package
buildInputs = [ pkgs.unzip ];
# Installing simply means copying all files to the output directory
installPhase = "mkdir -p $out; cp -R * $out/";
};
in
{
services.wordpress.sites."webservice5" = {
themes = [ responsiveTheme ];
plugins = [ akismetPlugin ];
virtualHost = {
adminAddr = "js@lastlog.de";
serverAliases = [ "webservice5" "www.webservice5" ];
};
};
}
Hopefully Wordpress plugins and themes will also be packaged inside the Nixpkgs repository, see this draft pull request.