feat: try rework

This commit is contained in:
Katharina Heidenreich 2026-04-04 11:42:19 +02:00
parent 1ddbd3b8b6
commit ecf10628c3
51 changed files with 1941 additions and 445 deletions

View file

@ -0,0 +1,36 @@
let
common = import ./common.nix;
in
rec {
getKiwix = serviceData:
let
kiwix =
if serviceData ? kiwix then
common.ensureAttrset "config/services.nix kiwix" serviceData.kiwix
else
throw "config/services.nix must define kiwix attrset.";
rootDir =
if kiwix ? root_dir then
common.ensureNonEmptyString "config/services.nix kiwix.root_dir" kiwix.root_dir
else
throw "config/services.nix kiwix.root_dir must exist.";
webPort =
if kiwix ? port then
common.ensureInt "config/services.nix kiwix.port" kiwix.port
else
throw "config/services.nix kiwix.port must exist.";
zimUrls =
if kiwix ? urls then
common.ensureList "config/services.nix kiwix.urls" kiwix.urls
else
throw "config/services.nix kiwix.urls must exist.";
in
{
root_dir = rootDir;
port = webPort;
urls = zimUrls;
};
}