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; }); }; };