From c941ccb42b99d2686b4b573c8cb7a16a17e87b49 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 1 Oct 2023 01:49:43 +0300 Subject: feat(tazjin/koptevo): deploy airsonic at player.tazj.in Change-Id: I9f0dec6491906319550c97d4cc15b2cdda4a5ebe Reviewed-on: https://cl.tvl.fyi/c/depot/+/9499 Tested-by: BuildkiteCI Reviewed-by: tazjin Autosubmit: tazjin --- users/tazjin/nixos/koptevo/default.nix | 3 ++- users/tazjin/nixos/modules/airsonic.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 users/tazjin/nixos/modules/airsonic.nix (limited to 'users/tazjin/nixos') diff --git a/users/tazjin/nixos/koptevo/default.nix b/users/tazjin/nixos/koptevo/default.nix index 0753f6ff5a0a..dabe334d295c 100644 --- a/users/tazjin/nixos/koptevo/default.nix +++ b/users/tazjin/nixos/koptevo/default.nix @@ -12,10 +12,11 @@ in (mod "quassel.nix") (mod "www/base.nix") (mod "www/tazj.in.nix") + (usermod "airsonic.nix") + (usermod "geesefs.nix") (usermod "monica.nix") (usermod "predlozhnik.nix") (usermod "tgsa.nix") - (usermod "geesefs.nix") (depot.third_party.agenix.src + "/modules/age.nix") ]; 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;"; + }; +} -- cgit 1.4.1