flake/modules/nixos/server/homebox.nix
2025-01-13 15:51:33 +00:00

36 lines
967 B
Nix

{ pkgs, lib, config, ... }:
let
cfg = config.mods.server.homebox;
port = config.mods.server.nginx.ports.homebox;
in with lib; {
options.mods.server = {
homebox = {
enable = mkEnableOption {
default = false;
description = "enables homebox server";
};
location = mkOption {
default = "/srv/homebox/data";
description = "location for homebox data";
};
};
};
config = mkIf cfg.enable {
services.homebox = {
enable = true;
settings = {
HBOX_WEB_PORT = toString port;
HBOX_WEB_HOST = "0.0.0.0";
HBOX_STORAGE_DATA = cfg.location;
HBOX_STORAGE_SQLITE_URL =
"${cfg.location}/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1";
HBOX_OPTIONS_ALLOW_REGISTRATION = "false";
HBOX_MODE = "production";
};
};
systemd.services.homebox.serviceConfig.WorkingDirectory =
mkForce cfg.location;
};
}