2021-12-07 08:34:21 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2022-09-16 01:29:46 +02:00
|
|
|
with lib;
|
2021-12-07 08:34:21 +01:00
|
|
|
let
|
2022-09-16 01:29:46 +02:00
|
|
|
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";
|
|
|
|
|
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";
|
2022-11-25 18:55:45 +01:00
|
|
|
templates = [ template-chippedsnow ];
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
$conf['title'] = 'Chroniques d\'Arkadia';
|
|
|
|
|
$conf['template'] = 'chippedsnow';
|
|
|
|
|
'';
|
2021-12-07 08:34:21 +01:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."${name}.${config.networking.domain}" = {
|
|
|
|
|
forceSSL = true;
|
|
|
|
|
enableACME = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
2022-09-16 01:29:46 +02:00
|
|
|
{
|
|
|
|
|
options.custom.services.dokuwiki = {
|
|
|
|
|
|
|
|
|
|
enable = mkEnableOption "dokuwiki";
|
|
|
|
|
|
|
|
|
|
secretKeyFile = mkOption {
|
|
|
|
|
type = types.path;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable
|
|
|
|
|
(lib.mkMerge [
|
|
|
|
|
(configureWiki "anderia")
|
|
|
|
|
(configureWiki "arkadia")
|
|
|
|
|
]);
|
|
|
|
|
}
|