1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/systems/makanek/radio-news.nix

49 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2022-03-10 21:52:12 +01:00
{
2025-05-13 19:51:43 +02:00
config,
2022-03-10 21:52:12 +01:00
pkgs,
lib,
...
2025-12-25 14:22:52 +01:00
}:
{
services.nginx.virtualHosts."redaktion.r".locations."/".extraConfig =
pkgs.lib.niveum.serveHtml ../../packages/radio-news/index.html pkgs;
2025-05-13 19:51:43 +02:00
age.secrets = {
gemini-api-key.file = ../../secrets/gemini-api-key.age;
};
systemd.services.news-digest = {
enable = true;
2025-12-25 14:22:52 +01:00
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
2025-05-13 19:51:43 +02:00
serviceConfig.LoadCredential = [
"gemini-api-key:${config.age.secrets.gemini-api-key.path}"
];
2025-05-16 14:03:42 +02:00
startAt = "*:50";
2025-05-13 19:51:43 +02:00
script = ''
2025-12-25 14:22:52 +01:00
PATH=$PATH:${
lib.makeBinPath [
pkgs.gnused
pkgs.curl
pkgs.jq
]
}
2025-05-13 19:51:43 +02:00
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/')" '
2025-05-13 19:51:43 +02:00
{
2025-06-03 20:07:49 +02:00
from: $from,
to: $to,
text: .candidates[].content.parts[].text
}' | curl -s -X POST http://radio-news.r -H "Content-Type: application/json" -d @-
2025-05-13 19:51:43 +02:00
'';
};
2022-05-22 11:47:59 +02:00
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.";
}
];
2022-02-22 20:34:53 +01:00
}