{config, ...}: let
  vars = import ../../../../vars.nix;
in {
  virtualisation.arion = {
    projects.media.settings = {
      imports = [./arion-compose.nix];
    };
  };

  sops.secrets."navidrome/spotify_id" = {
    owner = vars.user;
  };

  sops.secrets."navidrome/spotify_secret" = {
    owner = vars.user;
  };
  sops.secrets."navidrome/lastfm_api_key" = {
    owner = vars.user;
  };
  sops.secrets."navidrome/lastfm_api_secret" = {
    owner = vars.user;
  };

  sops.secrets."windscribe/openvpn_username" = {
    owner = vars.user;
  };
  sops.secrets."windscribe/openvpn_password" = {
    owner = vars.user;
  };

  sops.secrets."unpackerr/sonarr_api_key" = {
    owner = vars.user;
  };
  sops.secrets."unpackerr/radarr_api_key" = {
    owner = vars.user;
  };
  sops.secrets."unpackerr/lidarr_api_key" = {
    owner = vars.user;
  };

  sops.templates."navidrome.env" = {
    path = "/home/${vars.user}/.docker/media/navidrome.env";
    owner = vars.user;
    mode = "0775";
    content = ''
      ND_SPOTIFY_ID="${config.sops.placeholder."navidrome/spotify_id"}"
      ND_SPOTIFY_SECRET="${config.sops.placeholder."navidrome/spotify_secret"}"
      ND_LASTFM_APIKEY="${config.sops.placeholder."navidrome/lastfm_api_key"}"
      ND_LASTFM_SECRET="${config.sops.placeholder."navidrome/lastfm_api_secret"}"
    '';
  };

  sops.templates."windscribe.env" = {
    path = "/home/${vars.user}/.docker/media/windscribe.env";
    owner = vars.user;
    mode = "0775";
    content = ''
      OPENVPN_USERNAME="${config.sops.placeholder."windscribe/openvpn_username"}"
      OPENVPN_PASSWORD="${config.sops.placeholder."windscribe/openvpn_password"}"
    '';
  };

  sops.templates."unpackerr.env" = {
    path = "/home/${vars.user}/.docker/media/unpackerr.env";
    owner = vars.user;
    mode = "0775";
    content = ''
      UN_SONARR_0_API_KEY="${config.sops.placeholder."unpackerr/sonarr_api_key"}"
      UN_RADARR_0_API_KEY="${config.sops.placeholder."unpackerr/lidarr_api_key"}"
      UN_LIDARR_0_API_KEY="${config.sops.placeholder."unpackerr/radarr_api_key"}"
    '';
  };
}