refactor(nixos): separate RomM service policy

This commit is contained in:
2026-10-19 22:51:35 -04:00
parent 509b2f8656
commit 9636d52a14
2 changed files with 59 additions and 22 deletions

View File

@@ -130,29 +130,10 @@ in
}
];
registry."stable-uid".${config.networking.hostName} = {
romm = 20005;
"redis-romm" = 20006;
};
guests.romm = {
interior = {
networking.firewall.allowedTCPPorts = [ 80 ];
services.romm = {
enable = true;
group = "storage";
database.createLocally = true;
redis.createLocally = true;
watcher.enable = true;
nginx.virtualHost = cfg.reverseProxy.route.domain;
inherit environmentFile;
};
users.users = {
romm.uid = rommUid;
redis-romm.uid = redisUid;
};
interior.modules.services.romm = {
enable = true;
virtualHost = cfg.reverseProxy.route.domain;
};
mounts = {

View File

@@ -0,0 +1,56 @@
{
config,
lib,
...
}:
let
cfg = config.modules.services.romm;
rommUid = config.registry."stable-uid".${config.networking.hostName}.romm;
redisUid = config.registry."stable-uid".${config.networking.hostName}."redis-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 = rommUid;
redis-romm.uid = redisUid;
};
})
];
}