{ config, pkgs, ... }:

{
  # TODO: remove from user
  users.users.caddy.extraGroups = [ "users" ];
  systemd.tmpfiles.rules = [
    "d /var/www/danielk.me 0755 daniel users - -"
    "d /var/www/danielk.me/public 0755 daniel users - -"
  ];
  services.caddy = {
    enable = true;
    virtualHosts."danielk.me" = {
      extraConfig = ''
        handle_path /graphs/* {
          root * /var/www/danielk.me/betterGraphs
          file_server
        }
  
        handle_path /tails/* {
          root * /var/www/danielk.me/tails
          file_server
        }
  
        handle_path /public/* {
          root * /var/www/danielk.me/public
          file_server browse
        }
      '';
    };
  };
}
