about summary refs log tree commit diff
path: root/users/tazjin/nixos/modules/airsonic.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-09-30T22·49+0300
committerclbot <clbot@tvl.fyi>2023-10-01T14·26+0000
commitc941ccb42b99d2686b4b573c8cb7a16a17e87b49 (patch)
tree60b06f4b1f31b910f880a87d7f683f898919afea /users/tazjin/nixos/modules/airsonic.nix
parent4ab0a9498f4486cf818a0c307528e2dd2000d231 (diff)
feat(tazjin/koptevo): deploy airsonic at player.tazj.in r/6682
Change-Id: I9f0dec6491906319550c97d4cc15b2cdda4a5ebe
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9499
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/tazjin/nixos/modules/airsonic.nix')
-rw-r--r--users/tazjin/nixos/modules/airsonic.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/users/tazjin/nixos/modules/airsonic.nix b/users/tazjin/nixos/modules/airsonic.nix
new file mode 100644
index 000000000000..815f18377883
--- /dev/null
+++ b/users/tazjin/nixos/modules/airsonic.nix
@@ -0,0 +1,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;";
+  };
+}