module(wp): nixfmt
This commit is contained in:
parent
a37d79c31c
commit
ebc7790ab6
1 changed files with 36 additions and 39 deletions
|
@ -2,67 +2,63 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.services.wordpress;
|
||||
appConfig = (import ./default-app-config.nix).extend (self: super: {});
|
||||
appConfig = (import ./default-app-config.nix).extend (self: super: { });
|
||||
writeableDataPath = "/var/lib/phpfpm/${appConfig.name}";
|
||||
phpFpmListen = "/run/phpfpm/wordpress-pool.sock";
|
||||
phpFpmListen = "/run/phpfpm/wordpress-pool.sock";
|
||||
phpIni = import ./php-config.nix { inherit pkgs config appConfig; };
|
||||
enablePageSpeed = pkgs.stdenv.isLinux && appConfig.googlePageSpeed.enable;
|
||||
enablePageSpeed = pkgs.stdenv.isLinux && appConfig.googlePageSpeed.enable;
|
||||
app = callPackage ./app.nix {
|
||||
inherit appConfig;
|
||||
writeable = {
|
||||
sysPath = writeableDataPath;
|
||||
owner = config.services.nginx.user;
|
||||
owner = config.services.nginx.user;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.wordpress = {
|
||||
enable = mkEnableOption "Enable the WordPress module";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [
|
||||
pkgs.wp-cli
|
||||
];
|
||||
in {
|
||||
options.services.wordpress = {
|
||||
enable = mkEnableOption "Enable the WordPress module";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.wp-cli ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# package = pkgs.callPackage ./nginx.nix { inherit enablePageSpeed; };
|
||||
# httpConfig = nginxConfig;
|
||||
# TODO: ajouter les locations pour wordpress
|
||||
};
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# package = pkgs.callPackage ./nginx.nix { inherit enablePageSpeed; };
|
||||
# httpConfig = nginxConfig;
|
||||
# TODO: ajouter les locations pour wordpress
|
||||
};
|
||||
|
||||
systemd.services.init-writeable-paths = {
|
||||
description = "Initialize writeable directories for the app";
|
||||
before = [ "phpfpm.service" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" "phpfpm.service" "nginx.service" ];
|
||||
description = "Initialize writeable directories for the app";
|
||||
before = [ "phpfpm.service" ];
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" "phpfpm.service" "nginx.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Type = "oneshot";
|
||||
ExecStart = app.initScript;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
systemd.services.install-wp = let
|
||||
deps = [ "init-writeable-paths.service" "mysql.service" ];
|
||||
systemd.services.install-wp =
|
||||
let deps = [ "init-writeable-paths.service" "mysql.service" ];
|
||||
in {
|
||||
enable = appConfig.autoInstall.enable;
|
||||
description = "Configure WordPress installation with WP-CLI";
|
||||
before = [ "nginx.service" ];
|
||||
after = deps;
|
||||
wants = deps;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
enable = appConfig.autoInstall.enable;
|
||||
description = "Configure WordPress installation with WP-CLI";
|
||||
before = [ "nginx.service" ];
|
||||
after = deps;
|
||||
wants = deps;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = import ./install-wp.nix {
|
||||
Type = "oneshot";
|
||||
ExecStart = import ./install-wp.nix {
|
||||
inherit pkgs config appConfig writeableDataPath;
|
||||
appPackage = app.package;
|
||||
};
|
||||
};
|
||||
environment.PHP_INI_SCAN_DIR = let
|
||||
customIni = pkgs.writeTextDir "wp-cli-custom.ini" phpIni;
|
||||
environment.PHP_INI_SCAN_DIR =
|
||||
let customIni = pkgs.writeTextDir "wp-cli-custom.ini" phpIni;
|
||||
in "${pkgs.php}/etc:${customIni}";
|
||||
};
|
||||
};
|
||||
|
||||
services.phpfpm = {
|
||||
phpOptions = phpIni;
|
||||
|
@ -76,4 +72,5 @@ in
|
|||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue