self-hosting/modules/dokuwiki.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2021-12-07 08:34:21 +01:00
{ config, lib, pkgs, ... }:
with lib;
2021-12-07 08:34:21 +01:00
let
cfg = config.custom.services.dokuwiki;
2021-12-07 08:34:21 +01:00
configureWiki = name: {
2021-12-09 17:43:38 +01:00
sops.secrets."usersFile-${name}" = {
owner = "dokuwiki";
key = "wiki/${name}/users_file";
restartUnits = [ "phpfpm-dokuwiki-${name}.${config.networking.domain}.service" ];
};
2021-12-07 08:34:21 +01:00
services.dokuwiki.sites = {
"${name}.${config.networking.domain}" = {
enable = true;
stateDir = "/nix/var/data/dokuwiki/${name}/data";
2021-12-09 17:43:38 +01:00
usersFile = config.sops.secrets."usersFile-${name}".path;
disableActions = "register";
2021-12-07 08:34:21 +01:00
};
};
services.phpfpm.pools."dokuwiki-${name}.${config.networking.domain}".phpPackage = lib.mkOverride 10 pkgs.php74;
services.nginx.virtualHosts."${name}.${config.networking.domain}" = {
forceSSL = true;
enableACME = true;
};
};
in
{
options.custom.services.dokuwiki = {
enable = mkEnableOption "dokuwiki";
secretKeyFile = mkOption {
type = types.path;
};
};
config = mkIf cfg.enable
(lib.mkMerge [
(configureWiki "anderia")
(configureWiki "arkadia")
]);
}