Files
Alexander 908c37f73f Add NixOS module for full agregators stack with VM test
Module manages PostgreSQL (both databases + schema init), qBittorrent
(VPN-confined via VPN-Confinement), Jackett, metadata-agregator,
musicfs, and the main orchestrator. All services are independently
enableable with auto-wired inter-service configuration.

Includes NixOS VM test validating PostgreSQL setup, schema
initialization, service startup, and directory creation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 12:39:04 +02:00

69 lines
1.6 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.agregators;
in
{
imports = [
./postgres.nix
./vpn.nix
./qbittorrent.nix
./jackett.nix
./metadata-agregator.nix
./musicfs.nix
./music-agregator.nix
];
options.services.agregators = {
enable = lib.mkEnableOption "agregators music automation pipeline";
mediaDir = lib.mkOption {
type = lib.types.path;
default = "/data/music";
description = ''
Root directory for music files.
qBittorrent downloads here, musicfs reads from here.
'';
};
stateDir = lib.mkOption {
type = lib.types.path;
default = "/var/lib/agregators";
description = "Root state directory. Per-service subdirectories are created automatically.";
};
user = lib.mkOption {
type = lib.types.str;
default = "agregators";
description = "Shared system user for all agregators services.";
};
group = lib.mkOption {
type = lib.types.str;
default = "agregators";
description = "Shared system group for all agregators services.";
};
};
config = lib.mkIf cfg.enable {
users.users.${cfg.user} = lib.mkIf (cfg.user == "agregators") {
isSystemUser = true;
group = cfg.group;
home = cfg.stateDir;
};
users.groups.${cfg.group} = lib.mkIf (cfg.group == "agregators") { };
systemd.tmpfiles.rules = [
"d '${cfg.mediaDir}' 0775 ${cfg.user} ${cfg.group} - -"
"d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.stateDir}/postgres' 0770 ${cfg.user} ${cfg.group} - -"
];
};
}