NixOS/modules/servers/multi-scrobbler.nix

54 lines
1.8 KiB
Nix

{ lib, config, proxyReverse, ... }:
let
port = 9078;
domain = "scrobble.${config.my.domain}";
url = "https://${domain}";
in {
options.my.servers.multi-scrobbler.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.servers.multi-scrobbler.enable {
sops.secrets = {
"maloja/apikey" = { };
"multi-scrobbler/deezer/client-id" = { };
"multi-scrobbler/deezer/client-secret" = { };
};
virtualisation.oci-containers = {
backend = "docker";
containers.multi-scrobbler = {
image = "foxxmd/multi-scrobbler";
ports = [ "${toString port}:${toString port}" ];
environment = {
TZ = "America/Mexico_City";
PUID = "1000";
PGID = "100";
BASE_URL = url;
# JELLYFIN_USER = "jawz";
# JELLYFIN_SERVER = "DaniloFlix";
DEEZER_CLIENT_ID = "cat ${
config.sops.secrets."multi-scrobbler/deezer/client-id".path
}";
DEEZER_CLIENT_SECRET = "cat ${
config.sops.secrets."multi-scrobbler/deezer/client-secret".path
}";
DEEZER_REDIRECT_URI = "http://${config.my.miniserver-ip}:${
toString port
}/deezer/callback";
MALOJA_URL = "https://maloja.${config.my.domain}";
MALOJA_API_KEY = "cat ${config.sops.secrets."maloja/apikey".path}";
WS_ENABLE = "true";
};
volumes = [ "${config.my.containerData}/multi-scrobbler:/config" ];
labels = {
"flame.type" = "application";
"flame.name" = "Multi-scrobbler";
"flame.url" = url;
"flame.icon" = "broadcast";
};
};
};
services.nginx = {
enable = true;
virtualHosts."${domain}" = proxyReverse port // { };
};
};
}