97 lines
2.4 KiB
Nix
97 lines
2.4 KiB
Nix
{ config
|
|
, pkgs
|
|
, lib
|
|
, ...
|
|
}:
|
|
let
|
|
cfg = config.services.homepage;
|
|
in
|
|
{
|
|
options.services.homepage = {
|
|
enable = lib.mkEnableOption "Homepage dashboard (gethomepage.dev)";
|
|
|
|
port = lib.mkOption {
|
|
type = lib.types.port;
|
|
default = 8082;
|
|
description = "Port for the Homepage dashboard";
|
|
};
|
|
|
|
openFirewall = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Open the firewall for the Homepage dashboard";
|
|
};
|
|
|
|
allowedHosts = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [
|
|
"localhost"
|
|
"127.0.0.1"
|
|
];
|
|
description = "Host header values Homepage is allowed to respond to";
|
|
};
|
|
|
|
settings = lib.mkOption {
|
|
type = lib.types.anything;
|
|
default = { };
|
|
description = "Homepage settings (settings.yaml). See https://gethomepage.dev/configs/settings/";
|
|
};
|
|
|
|
services = lib.mkOption {
|
|
type = lib.types.anything;
|
|
default = [ ];
|
|
description = "Homepage services (services.yaml). See https://gethomepage.dev/configs/services/";
|
|
};
|
|
|
|
widgets = lib.mkOption {
|
|
type = lib.types.anything;
|
|
default = [ ];
|
|
description = "Homepage widgets (widgets.yaml). See https://gethomepage.dev/configs/info-widgets/";
|
|
};
|
|
|
|
bookmarks = lib.mkOption {
|
|
type = lib.types.anything;
|
|
default = [ ];
|
|
description = "Homepage bookmarks (bookmarks.yaml). See https://gethomepage.dev/configs/bookmarks/";
|
|
};
|
|
|
|
customCSS = lib.mkOption {
|
|
type = lib.types.lines;
|
|
default = "";
|
|
description = "Custom CSS for Homepage";
|
|
};
|
|
|
|
customJS = lib.mkOption {
|
|
type = lib.types.lines;
|
|
default = "";
|
|
description = "Custom JavaScript for Homepage";
|
|
};
|
|
|
|
environmentFiles = lib.mkOption {
|
|
type = lib.types.listOf lib.types.path;
|
|
default = [ ];
|
|
description = "Environment files passed to the Homepage service (for API keys etc.)";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.homepage-dashboard = {
|
|
enable = true;
|
|
listenPort = cfg.port;
|
|
openFirewall = cfg.openFirewall;
|
|
allowedHosts = lib.concatStringsSep "," (
|
|
map (host: "${host}:${toString cfg.port}") cfg.allowedHosts
|
|
);
|
|
inherit (cfg)
|
|
settings
|
|
services
|
|
widgets
|
|
bookmarks
|
|
customCSS
|
|
customJS
|
|
environmentFiles
|
|
;
|
|
};
|
|
};
|
|
}
|