nixos/modules/services/homer/default.nix

70 lines
1.4 KiB
Nix
Raw Normal View History

# Dashboard site
2024-07-28 21:08:02 +02:00
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.services.homer;
2023-11-07 23:13:51 +01:00
inherit (config.networking) domain;
homeConfig = {
title = "Dashboard";
header = false;
footer = false;
connectivityCheck = true;
2023-06-22 20:54:16 +02:00
columns = "auto";
services = config.lib.webapps.homerServices;
};
in
{
2024-07-28 21:08:02 +02:00
imports = [ ./config.nix ];
options.my.services.homer = with lib; {
enable = mkEnableOption "Homer Dashboard";
};
config = lib.mkIf cfg.enable {
services.nginx.virtualHosts = {
# This is not a subdomain, cannot use my nginx wrapper module
${domain} = {
forceSSL = true;
useACMEHost = domain;
root = pkgs.homer;
locations."=/assets/config.yml" = {
alias = pkgs.writeText "homerConfig.yml" (builtins.toJSON homeConfig);
};
};
# redirect any other attempt to the main site
"${domain}-redirect" = {
forceSSL = true;
useACMEHost = domain;
default = true;
globalRedirect = "${domain}";
};
};
webapps = {
dashboardCategories = [
2024-07-28 21:08:02 +02:00
{
name = "Applications";
tag = "app";
}
{
name = "Media";
tag = "media";
}
{
name = "Infrastructure";
tag = "infra";
}
{
name = "Others";
tag = "other";
}
];
};
};
}