908c37f73f
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>
76 lines
1.9 KiB
Nix
76 lines
1.9 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.agregators;
|
|
jackettCfg = cfg.jackett;
|
|
in
|
|
{
|
|
options.services.agregators.jackett = {
|
|
enable = lib.mkEnableOption "Jackett torrent indexer aggregator";
|
|
|
|
port = lib.mkOption {
|
|
type = lib.types.port;
|
|
default = 9117;
|
|
description = "Jackett HTTP port.";
|
|
};
|
|
|
|
stateDir = lib.mkOption {
|
|
type = lib.types.path;
|
|
default = "${cfg.stateDir}/jackett";
|
|
defaultText = lib.literalExpression ''"''${cfg.stateDir}/jackett"'';
|
|
description = "Jackett data directory.";
|
|
};
|
|
|
|
apiKeyFile = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.path;
|
|
default = null;
|
|
description = ''
|
|
File containing the Jackett API key.
|
|
If null, music-agregator must be configured with the API key manually.
|
|
'';
|
|
};
|
|
|
|
package = lib.mkPackageOption pkgs "jackett" { };
|
|
|
|
openFirewall = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Open the Jackett port in the firewall.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (cfg.enable && jackettCfg.enable) {
|
|
systemd.tmpfiles.rules = [
|
|
"d '${jackettCfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -"
|
|
];
|
|
|
|
systemd.services.jackett = {
|
|
description = "Jackett torrent indexer aggregator";
|
|
after = [ "network-online.target" ];
|
|
wants = [ "network-online.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = cfg.user;
|
|
Group = cfg.group;
|
|
ExecStart = lib.concatStringsSep " " [
|
|
"${lib.getExe jackettCfg.package}"
|
|
"--DataFolder=${jackettCfg.stateDir}"
|
|
"--Port=${toString jackettCfg.port}"
|
|
"--NoUpdates"
|
|
];
|
|
Restart = "on-failure";
|
|
RestartSec = 5;
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = lib.mkIf jackettCfg.openFirewall [ jackettCfg.port ];
|
|
};
|
|
}
|