mirror of
https://github.com/kmein/niveum
synced 2026-03-16 18:21:07 +01:00
feat: add serveHtml helper
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
{ pkgs, lib, ... }:
|
||||
let
|
||||
inherit (import <niveum/lib>) serveHtml;
|
||||
stations = [
|
||||
900068204 # A/M
|
||||
900068302 # KAS
|
||||
900068203 # B-P
|
||||
];
|
||||
fahrplanHtml = ''
|
||||
fahrplan = pkgs.writeText "fahrplan.html" ''
|
||||
<!DOCTYPE html>
|
||||
<title>Fahrplan</title>
|
||||
<link
|
||||
@@ -51,10 +52,6 @@ in
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."bvg.kmein.r" = {
|
||||
locations."/".extraConfig = ''
|
||||
default_type "text/html";
|
||||
root ${pkgs.linkFarm "fahrplan" [{ name = "index.html"; path = pkgs.writeText "fahrplan.html" fahrplanHtml; }]};
|
||||
index index.html;
|
||||
'';
|
||||
locations."/".extraConfig = serveHtml fahrplan pkgs;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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}";
|
||||
|
||||
Reference in New Issue
Block a user