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:
parent
a1306237f6
commit
ef7aaacfc8
@ -16,6 +16,12 @@ with lib; {
|
||||
unbound.enable = mkEnableOption "Set unbound dns up";
|
||||
grocy.enable = mkEnableOption "Set up grocy";
|
||||
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 = [
|
||||
@ -28,6 +34,7 @@ with lib; {
|
||||
./smailserver.nix
|
||||
./sql.nix
|
||||
./unbound.nix
|
||||
./wordpress.nix
|
||||
];
|
||||
|
||||
config = let
|
||||
@ -42,6 +49,7 @@ with lib; {
|
||||
unbound.enable = mkDefault true;
|
||||
grocy.enable = mkDefault true;
|
||||
gitea.enable = mkDefault true;
|
||||
wordpress.enable = mkDefault true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
82
modules/server/wordpress.nix
Normal file
82
modules/server/wordpress.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user