1
0
Fork 0
mirror of https://git.sr.ht/~roxwize/.dotfiles synced 2025-04-03 18:14:15 +00:00
.dotfiles/nixos/docker/homepage/default.nix
2025-03-06 23:27:26 -05:00

36 lines
1,000 B
Nix

{ pkgs, lib, config, ... }: let
cfg = config.r5e.containers.homepage;
settingsFormat = pkgs.formats.yaml {};
in {
options.r5e.containers.homepage = {
enable = lib.mkEnableOption "homepage";
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
};
settings = lib.mkOption {
inherit (settingsFormat) type;
description = "See https://gethomepage.dev/configs/settings/";
default = {};
};
widgets = lib.mkOption {
inherit (settingsFormat) type;
description = "See https://gethomepage.dev/widgets/";
default = [];
};
};
config = lib.mkMerge [
(import ./compose.nix { inherit pkgs lib; })
{
environment.etc = lib.mkIf cfg.enable {
"homepage-dashboard/settings.yaml".source = settingsFormat.generate "settings.yaml" cfg.settings;
"homepage-dashboard/widgets.yaml".source = settingsFormat.generate "widgets.yaml" cfg.widgets;
};
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ 3000 ];
};
}
];
}