refactor(nixos): separate RomM service policy
This commit is contained in:
@@ -130,29 +130,10 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
registry."stable-uid".${config.networking.hostName} = {
|
|
||||||
romm = 20005;
|
|
||||||
"redis-romm" = 20006;
|
|
||||||
};
|
|
||||||
|
|
||||||
guests.romm = {
|
guests.romm = {
|
||||||
interior = {
|
interior.modules.services.romm = {
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
enable = true;
|
||||||
|
virtualHost = cfg.reverseProxy.route.domain;
|
||||||
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;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mounts = {
|
mounts = {
|
||||||
|
|||||||
56
configs/nixos/modules/services/romm.nix
Normal file
56
configs/nixos/modules/services/romm.nix
Normal 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;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user