{ lib, env, stdenv, fetchurl, shaarli, config }:
let
varDir = "/var/lib/shaarli";
in rec {
activationScript = ''
install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \
${varDir}/cache ${varDir}/pagecache ${varDir}/tmp ${varDir}/data
'';
webRoot = shaarli.override { inherit varDir; };
apache = rec {
user = "wwwrun";
group = "wwwrun";
modules = [ "proxy_fcgi" "rewrite" "env" ];
root = webRoot;
vhostConf = socket: ''
Alias /Shaarli "${root}"
Include ${config.secrets.fullPaths."webapps/tools-shaarli"}