42 lines
878 B
Nix
Raw Normal View History

2025-01-20 22:35:40 -05:00
{
config,
lib,
...
}:
let
cfg = config.nmasur.presets.services.filebrowser;
2025-02-08 12:58:06 -05:00
hostnames = config.nmasur.settings.hostnames;
2025-01-20 22:35:40 -05:00
in
{
options.nmasur.presets.services.filebrowser.enable = lib.mkEnableOption "Filebrowser private files";
config = lib.mkIf cfg.enable {
services.filebrowser = {
enable = true;
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
password = "$2y$10$ze1cMob0k6pnXRjLowYfZOVZWg4G.dsPtH3TohbUeEbI0sdkG9.za";
};
caddy.routes = [
{
2025-02-08 12:58:06 -05:00
match = [ { host = [ hostnames.files ]; } ];
2025-01-20 22:35:40 -05:00
handle = [
{
handler = "reverse_proxy";
upstreams = [
{ dial = "localhost:8020"; }
];
}
];
}
];
# Configure Cloudflare DNS to point to this machine
2025-02-08 12:58:06 -05:00
services.cloudflare-dyndns.domains = [ hostnames.files ];
2025-01-20 22:35:40 -05:00
};
}