41 lines
762 B
Nix

{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.my.services.homer;
inherit (config.my.server) domain;
homeConfig = {
title = "Dashboard";
header = false;
footer = false;
connectivityCheck = true;
columns = "auto";
services = config.lib.webapps.homerServices;
};
in {
imports = [
./config.nix
];
options.my.services.homer = {
enable = mkEnableOption "Homer Dashboard";
};
config = mkIf cfg.enable {
services.caddy.virtualHosts."${domain}".extraConfig = ''
handle_path /assets/config.yml {
root * ${pkgs.writeText "homerConfig.yml" (builtins.toJSON homeConfig)}
file_server
}
root * ${pkgs.homer}
file_server {
hide .git
}
'';
};
}