65 lines
1.3 KiB
Nix
65 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.my.services.dashy;
|
|
in
|
|
{
|
|
|
|
options.my.services.dashy = {
|
|
enable = lib.mkEnableOption "Enable Dashy module";
|
|
|
|
settings = lib.mkOption {
|
|
default = { };
|
|
description = ''
|
|
Dashy settings as described here: https://search.nixos.org/options?type=packages&query=services.dashy.settings
|
|
'';
|
|
inherit (pkgs.formats.json { }) type;
|
|
};
|
|
|
|
proxy = {
|
|
enable = lib.mkEnableOption "Set the proxy entry for this service";
|
|
|
|
domain = lib.mkOption {
|
|
default = "example.com";
|
|
type = lib.types.str;
|
|
description = ''
|
|
The domain where Caddy is reachable
|
|
'';
|
|
};
|
|
|
|
host = lib.mkOption {
|
|
default = "localhost";
|
|
type = lib.types.str;
|
|
description = ''
|
|
host name where the service is running
|
|
'';
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = lib.mkMerge [
|
|
(lib.mkIf cfg.enable {
|
|
|
|
services.dashy = {
|
|
enable = true;
|
|
settings = cfg.settings;
|
|
};
|
|
|
|
})
|
|
|
|
(lib.mkIf cfg.proxy.enable {
|
|
services.caddy = with cfg.proxy; {
|
|
virtualHosts."home.${domain}".extraConfig = ''
|
|
root * ${config.services.dashy.finalDrv}
|
|
file_server
|
|
import cloudflare_${domain}
|
|
'';
|
|
};
|
|
})
|
|
];
|
|
}
|