1
0
mirror of https://github.com/kmein/niveum synced 2026-03-18 19:11:08 +01:00

feat: add serveHtml helper

This commit is contained in:
2021-10-11 20:02:17 +02:00
parent f6ffd477d1
commit 2384a4eef5
3 changed files with 11 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
{ lib, pkgs, config, ... }:
let
inherit (import <niveum/lib>) tmpfilesConfig;
inherit (import <niveum/lib>) tmpfilesConfig serveHtml;
radioStore = "/var/lib/radio";
htgenPort = 8080;
@@ -197,17 +197,7 @@ in
forceSSL = true;
locations = lib.mkMerge (
[
{
"/".extraConfig = ''
default_type "text/html";
root ${pkgs.linkFarm "station-list" [{
name = "index.html";
path = import ./station-list.nix { inherit pkgs lib stations; };
}]};
index index.html;
'';
# skip
}
{ "/".extraConfig = serveHtml (import ./station-list.nix { inherit pkgs lib stations; }) pkgs; }
] ++ (lib.mapAttrsToList (name: station: {
"= /${name}/status".proxyPass = "http://127.0.0.1:${toString htgenPort}";
"= /${name}/listen.ogg".proxyPass = "http://127.0.0.1:${toString station.streamPort}";