about summary refs log tree commit diff
path: root/users/tazjin/nixos/modules/airsonic.nix
blob: 815f18377883dc106f6a41dffe0b3f6b10f68d55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# airsonic is a decent, web-based player UI for subsonic
{ pkgs, ... }:

let
  env = builtins.toFile "env.js" ''
    window.env = {
      SERVER_URL: "https://music.tazj.in",
    }
  '';

  airsonicDist = pkgs.fetchzip {
    name = "airsonic-refix";

    # from master CI @ f894d5eacebec2f47486f340c8610f446d4f64b3
    # https://github.com/tamland/airsonic-refix/actions/runs/6150155527
    url = "https://storage.yandexcloud.net/tazjin-public/airsonic-refix-f894d5ea.zip";
    sha256 = "02rnh9h7rh22wkghays389yddwbwg7sawmczdxdmjrcnkc7mq2jz";

    stripRoot = false;
    postFetch = "cp ${env} $out/env.js";
  };
in
{
  services.nginx.virtualHosts."player.tazj.in" = {
    enableACME = true;
    forceSSL = true;
    root = "${airsonicDist}";

    # deal with SPA routing requirements
    locations."/".extraConfig = "try_files $uri /index.html;";
  };
}