mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
49 lines
1.3 KiB
Nix
49 lines
1.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
services.nginx.virtualHosts."redaktion.r".locations."/".extraConfig =
|
|
pkgs.lib.niveum.serveHtml ../../packages/radio-news/index.html pkgs;
|
|
|
|
age.secrets = {
|
|
gemini-api-key.file = ../../secrets/gemini-api-key.age;
|
|
};
|
|
|
|
systemd.services.news-digest = {
|
|
enable = true;
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network-online.target" ];
|
|
serviceConfig.LoadCredential = [
|
|
"gemini-api-key:${config.age.secrets.gemini-api-key.path}"
|
|
];
|
|
startAt = "*:50";
|
|
script = ''
|
|
PATH=$PATH:${
|
|
lib.makeBinPath [
|
|
pkgs.gnused
|
|
pkgs.curl
|
|
pkgs.jq
|
|
]
|
|
}
|
|
|
|
GEMINI_API_KEY="$(cat "$CREDENTIALS_DIRECTORY/gemini-api-key")" ${pkgs.radio-news}/bin/radio-news | jq --arg from "$(date -u -Is | sed 's/+00:00/Z/')" --arg to "$(date -u -Is -d 'now + 30 minutes' | sed 's/+00:00/Z/')" '
|
|
{
|
|
from: $from,
|
|
to: $to,
|
|
text: .candidates[].content.parts[].text
|
|
}' | curl -s -X POST http://radio-news.r -H "Content-Type: application/json" -d @-
|
|
'';
|
|
};
|
|
|
|
niveum.passport.services = [
|
|
{
|
|
title = "Retiolum Radio News";
|
|
link = "http://redaktion.r";
|
|
description = "supplies git history news to radio lassulus and lets you enter your own.";
|
|
}
|
|
];
|
|
}
|