Add homebox

This commit is contained in:
muon 2025-01-13 12:35:13 +00:00
parent 40eb62a6bd
commit 411024cd3c
6 changed files with 52 additions and 8 deletions

View file

@ -13,5 +13,6 @@
./search.nix
./nginx.nix
./frontends.nix
./homebox.nix
];
}

View file

@ -9,6 +9,10 @@ in with lib; {
default = false;
description = "enables grav service";
};
location = mkOption {
default = "/srv/grav";
description = "location for homebox data";
};
};
};
@ -18,7 +22,7 @@ in with lib; {
services.grav = mkIf cfg.grav.enable {
inherit port;
enable = true;
root = "/curr/grav/grav";
root = cfg.grav.location;
phpPackage = pkgs.php81;
};
users.users.${config.mods.user.name}.extraGroups = lib.mkAfter [ "grav" ];

View file

@ -0,0 +1,36 @@
{ 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 = "true";
HBOX_MODE = "production";
};
};
systemd.services.homebox.serviceConfig.WorkingDirectory =
mkForce cfg.location;
};
}

View file

@ -1,4 +1,3 @@
{ pkgs, lib, config, ... }: {
options.mods.server.photoprism = {
enable = lib.mkEnableOption {
@ -7,7 +6,6 @@
};
};
config = lib.mkIf config.mods.server.photoprism.enable {
services.photoprism = {
enable = true;
@ -35,12 +33,10 @@
dataDir = "/data/mysql";
package = pkgs.mariadb;
ensureDatabases = [ "photoprism" ];
ensureUsers = [ {
ensureUsers = [{
name = "photoprism";
ensurePermissions = {
"photoprism.*" = "ALL PRIVILEGES";
};
} ];
ensurePermissions = { "photoprism.*" = "ALL PRIVILEGES"; };
}];
};
};
}