From f9a8d428b188bf280ab96787b3bb3d558988efdc Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 8 Jan 2024 17:39:45 +0100 Subject: [PATCH] fix(wordpress): Use different local IP addresses --- machines/web01/wordpress/module.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/machines/web01/wordpress/module.nix b/machines/web01/wordpress/module.nix index 46181c5..90313de 100644 --- a/machines/web01/wordpress/module.nix +++ b/machines/web01/wordpress/module.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let inherit (lib) mkEnableOption mkIf mkOption; @@ -10,17 +10,12 @@ let mkName = builtins.replaceStrings [ "." ] [ "-" ]; - mkConfig = { name, value }: { + mkConfig = { name, value, i }: { services.wordpress = { webserver = "nginx"; sites.${name} = value; }; - security.acme = { - acceptTerms = true; - defaults.email = "acme@dgnum.eu"; - }; - services.nginx.virtualHosts.${name} = { onlySSL = true; sslCertificate = "${certs.${name}.directory}/fullchain.pem"; @@ -28,9 +23,14 @@ let sslTrustedCertificate = "${certs.${name}.directory}/chain.pem"; }; - networking.hostName = mkName name; + networking = { + hostName = mkName name; + hosts."10.0.0.${builtins.toString i}" = [ name ]; - networking.firewall.allowedTCPPorts = [ 443 ]; + firewall.allowedTCPPorts = [ 443 ]; + }; + + environment.systemPackages = [ pkgs.wp-cli ]; system.stateVersion = "23.11"; }; @@ -52,11 +52,11 @@ let }; hostAddress = "10.31.41.${builtins.toString i}"; - localAddress = "10.0.0.1"; + localAddress = "10.0.0.${builtins.toString i}"; autoStart = true; - config = mkConfig site; + config = mkConfig (site // { inherit i; }); }; };