self-hosting/modules/dokuwiki.nix

58 lines
1.6 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;
2022-11-25 18:55:45 +01:00
template-chippedsnow = pkgs.stdenv.mkDerivation {
name = "chippedsnow";
src = builtins.fetchGit {
url = "ssh://git@gitlab.com/desbest/Chipped-Snow-Dokuwiki-Template.git";
ref = "master";
rev = "61e525236063714cade90beb1401cde2c75e4c88";
};
installPhase = "mkdir -p $out; cp -R * $out/";
};
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";
2023-07-10 19:19:25 +02:00
restartUnits =
[ "phpfpm-dokuwiki-${name}.${config.networking.domain}.service" ];
2021-12-09 17:43:38 +01:00
};
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;
2022-11-25 18:55:45 +01:00
templates = [ template-chippedsnow ];
2023-07-10 19:19:25 +02:00
settings = {
useacl = true;
title = "Chroniques d`Arkadia";
template = "chippedsnow";
disableactions = "register";
2023-11-11 00:08:59 +01:00
dontlog = [ "debug" "deprecated" ];
2023-07-10 19:19:25 +02:00
};
2021-12-07 08:34:21 +01:00
};
};
services.nginx.virtualHosts."${name}.${config.networking.domain}" = {
forceSSL = true;
enableACME = true;
2023-09-14 06:36:39 +02:00
extraConfig = "client_max_body_size 25M;";
2021-12-07 08:34:21 +01:00
};
};
2023-07-10 19:19:25 +02:00
in {
options.custom.services.dokuwiki = {
enable = mkEnableOption "dokuwiki";
2023-07-10 19:19:25 +02:00
secretKeyFile = mkOption { type = types.path; };
};
config = mkIf cfg.enable
2023-07-10 19:19:25 +02:00
(lib.mkMerge [ (configureWiki "anderia") (configureWiki "arkadia") ]);
}