1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Add wordpress to server

This commit is contained in:
Stefan Ellmauthaler 2024-03-12 13:42:39 +01:00
parent a1306237f6
commit ef7aaacfc8
Failed to extract signature
2 changed files with 90 additions and 0 deletions

View File

@ -16,6 +16,12 @@ with lib; {
unbound.enable = mkEnableOption "Set unbound dns up"; unbound.enable = mkEnableOption "Set unbound dns up";
grocy.enable = mkEnableOption "Set up grocy"; grocy.enable = mkEnableOption "Set up grocy";
gitea.enable = mkEnableOption "Set up gitea"; gitea.enable = mkEnableOption "Set up gitea";
wordpress.enable = mkEnableOption "Set up wordpress";
wordpress.domain = mkOption {
type = types.str;
description = "domain for which it shall be set up";
default = "wp.ellmauthaler.net";
};
}; };
imports = [ imports = [
@ -28,6 +34,7 @@ with lib; {
./smailserver.nix ./smailserver.nix
./sql.nix ./sql.nix
./unbound.nix ./unbound.nix
./wordpress.nix
]; ];
config = let config = let
@ -42,6 +49,7 @@ with lib; {
unbound.enable = mkDefault true; unbound.enable = mkDefault true;
grocy.enable = mkDefault true; grocy.enable = mkDefault true;
gitea.enable = mkDefault true; gitea.enable = mkDefault true;
wordpress.enable = mkDefault true;
}; };
}; };
} }

View File

@ -0,0 +1,82 @@
{
config,
pkgs,
lib,
...
}:
with lib; {
config = let
cfg = config.elss.server.wordpress;
fetchPackage = {
name,
version,
hash,
isTheme,
}:
pkgs.stdenv.mkDerivation rec {
inherit name version hash;
src = let
type =
if isTheme
then "theme"
else "plugin";
in
pkgs.fetchzip {
inherit name version hash;
url = "https://downloads.wordpress.org/${type}/${name}.${version}.zip";
};
installPhase = "mkdir -p $out; cp -R * $out/";
};
fetchPlugin = {
name,
version,
hash,
}: (fetchPackage {
name = name;
version = version;
hash = hash;
isTheme = false;
});
fetchTheme = {
name,
version,
hash,
}: (fetchPackage {
name = name;
version = version;
hash = hash;
isTheme = true;
});
neve = fetchTheme {
name = "neve";
version = "3.8.3";
hash = "sha256-X3Jv2kn0FCCOPgrID0ZU8CuSjm/Ia/d+om/ShP5IBgA=";
};
antispam-bee = fetchPlugin {
name = "antispam-bee";
version = "2.1.15";
hash = "sha256-X3Jv2kn0FCCOPgrID0ZU8CuSjm/Ia/d+om/ShP5IBgA=";
};
wordpress-seo = fetchPlugin {
name = "wordpress-seo";
version = "22.2";
hash = "sha256-X3Jv2kn0FCCOPgrID0ZU8CuSjm/Ia/d+om/ShP5IBgA=";
};
in
mkIf cfg.enable {
services.wordpress = {
webserver = "nginx";
sites."${cfg.domain}" = {
plugins = {inherit antispam-bee wordpress-seo;};
themes = {inherit neve;};
settings = {WP_DEFAULT_THEME = "neve";};
virtualHost = {
enableACME = true;
forceSSL = true;
};
};
};
};
}