Files
dev/configs/nixos/modules/services/romm.nix

55 lines
1.2 KiB
Nix

{
config,
lib,
...
}:
let
cfg = config.modules.services.romm;
in
{
options.modules.services.romm = {
enable = lib.mkEnableOption "RomM";
environmentFile = lib.mkOption {
type = lib.types.path;
default = "/run/secrets/romm.env";
readOnly = true;
description = "Path to RomM's environment file.";
};
virtualHost = lib.mkOption {
type = lib.types.str;
example = "romm.example.org";
description = "Public host name configured in RomM's nginx.";
};
};
config = lib.mkMerge [
{
registry."stable-uid".${config.networking.hostName} = {
romm = 20005;
"redis-romm" = 20006;
};
}
(lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 80 ];
services.romm = {
enable = true;
group = "storage";
database.createLocally = true;
redis.createLocally = true;
watcher.enable = true;
nginx.virtualHost = cfg.virtualHost;
inherit (cfg) environmentFile;
};
users.users = {
romm.uid = config.registry."stable-uid".${config.networking.hostName}.romm;
redis-romm.uid = config.registry."stable-uid".${config.networking.hostName}."redis-romm";
};
})
];
}