summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-08-05 21:20:17 +0200
committermakefu <github@syntax-fehler.de>2021-08-05 21:20:17 +0200
commitc177a49ca38b8c1022638deaff2dc4eefda655f3 (patch)
tree201c4245203da92228c99f0940871a996e2efee7 /krebs
parenta072b9a49b6ee50bfdd57f62a3f60087e98c7c02 (diff)
parentba6a5456e8d76b9c1eae7cd81dca3f2b16359ba2 (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/reaktor2.nix165
-rw-r--r--krebs/3modules/external/default.nix1
-rw-r--r--krebs/3modules/krebs/default.nix1
-rw-r--r--krebs/3modules/repo-sync.nix1
-rw-r--r--krebs/5pkgs/simple/htgen/default.nix7
-rw-r--r--krebs/5pkgs/simple/rss-bridge/default.nix6
-rw-r--r--krebs/nixpkgs-unstable.json8
-rw-r--r--krebs/nixpkgs.json8
8 files changed, 157 insertions, 40 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix
index 14e0a3d7a..4a33c33ec 100644
--- a/krebs/2configs/reaktor2.nix
+++ b/krebs/2configs/reaktor2.nix
@@ -9,11 +9,11 @@ let
hooks = pkgs.reaktor2-plugins.hooks;
commands = pkgs.reaktor2-plugins.commands;
- task = name: let
- rcFile = builtins.toFile "taskrc" ''
- confirmation=no
- '';
- in {
+ taskRcFile = builtins.toFile "taskrc" ''
+ confirmation=no
+ '';
+
+ task = name: {
pattern = "^${name}-([a-z]+)(?::?\\s*(.*))?";
activate = "match";
command = 1;
@@ -21,19 +21,19 @@ let
env.TASKDATA = "${stateDir}/${name}";
commands = {
add.filename = pkgs.writeDash "${name}-task-add" ''
- ${pkgs.taskwarrior}/bin/task rc:${rcFile} add "$1"
+ ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} add "$1"
'';
list.filename = pkgs.writeDash "${name}-task-list" ''
- ${pkgs.taskwarrior}/bin/task rc:${rcFile} export \
+ ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} export \
| ${pkgs.jq}/bin/jq -r '
.[] | select(.id != 0) | "\(.id) \(.description)"
'
'';
delete.filename = pkgs.writeDash "${name}-task-delete" ''
- ${pkgs.taskwarrior}/bin/task rc:${rcFile} delete "$1"
+ ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} delete "$1"
'';
done.filename = pkgs.writeDash "${name}-task-done" ''
- ${pkgs.taskwarrior}/bin/task rc:${rcFile} done "$1"
+ ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} done "$1"
'';
};
};
@@ -120,8 +120,138 @@ in {
uid = genid_uint31 "reaktor2";
home = stateDir;
isSystemUser = true;
+ extraGroups = [ "reaktor2" ];
+ };
+
+ users.groups.reaktor2 = {};
+
+ systemd.services.htgen-agenda.serviceConfig.StateDirectory = "reaktor2";
+ krebs.htgen.agenda = {
+ port = 8009;
+ user = {
+ name = "reaktor2";
+ home = stateDir;
+ };
+ script = ''. ${pkgs.writeDash "agenda" ''
+ echo "$Method $Request_URI" >&2
+ case "$Method" in
+ "GET")
+ printf 'HTTP/1.1 200 OK\r\n'
+ printf 'Connection: close\r\n'
+ printf '\r\n'
+ TASKDATA=/var/lib/reaktor2/agenda ${pkgs.taskwarrior}/bin/task rc:${taskRcFile} export
+ exit
+ ;;
+ esac
+ ''}'';
+ };
+
+ services.nginx = {
+ virtualHosts."agenda.r" = {
+ locations."= /index.html".extraConfig = ''
+ alias ${pkgs.writeText "agenda.html" ''
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Agenda</title>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <style>
+ html {
+ font-family: monospace;
+ }
+
+ dt {
+ float: left;
+ clear: left;
+ width: 30px;
+ text-align: right;
+ font-weight: bold;
+ }
+
+ dd {
+ margin: 0 0 0 40px;
+ padding: 0 0 0.5em 0;
+ }
+
+ .date {
+ color: grey;
+ font-style: italic;
+ }
+ </style>
+ </head>
+ <body>
+ <dl id="agenda"></dl>
+ <script>
+ const urlSearchParams = new URLSearchParams(window.location.search);
+ const params = Object.fromEntries(urlSearchParams.entries());
+
+ if (params.hasOwnProperty("style")) {
+ const cssUrls = params["style"].split(" ").filter((x) => x.length > 0);
+ for (const cssUrl of cssUrls)
+ fetch(cssUrl)
+ .then((response) =>
+ response.text().then((css) => {
+ const title = document.getElementsByTagName("head")[0];
+ const style = document.createElement("style");
+ style.appendChild(document.createTextNode(css));
+ title.appendChild(style);
+ })
+ )
+ .catch(console.log);
+ }
+
+ fetch("/agenda.json")
+ .then((response) => {
+ response.json().then((agenda) => {
+ const dl = document.getElementById("agenda");
+ for (const agendaItem of agenda) {
+ if (agendaItem.status !== "pending") continue;
+ // task warrior date format to ISO
+ const entryDate = agendaItem.entry.replace(
+ /(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z/,
+ "$1-$2-$3T$4:$5:$6Z"
+ );
+
+ const dt = document.createElement("dt");
+ dt.className = "id";
+ dt.appendChild(document.createTextNode(agendaItem.id.toString()));
+ dl.appendChild(dt);
+
+ const spanDate = document.createElement("span");
+ spanDate.className = "date";
+ spanDate.title = new Date(entryDate).toString();
+ spanDate.appendChild(document.createTextNode(entryDate));
+
+ const dd = document.createElement("dd");
+ dd.className = "description";
+ dd.appendChild(document.createTextNode(agendaItem.description));
+ dd.appendChild(document.createTextNode(" "));
+ dd.appendChild(spanDate);
+
+ dl.appendChild(dd);
+ }
+ });
+ })
+ .then((data) => console.log(data));
+ </script>
+ </body>
+</html>
+ ''};
+ '';
+ locations."/agenda.json".extraConfig = ''
+ proxy_set_header Host $host;
+ proxy_pass http://localhost:8009;
+ '';
+ extraConfig = ''
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ '';
+ };
};
+ systemd.services.reaktor2-r.serviceConfig.DynamicUser = mkForce false;
+ systemd.services.reaktor2-hackint.serviceConfig.DynamicUser = mkForce false;
krebs.reaktor2 = {
hackint = {
hostname = "irc.hackint.org";
@@ -140,23 +270,6 @@ in {
username = "reaktor2";
port = "6697";
};
- freenode = {
- hostname = "irc.freenode.org";
- nick = "reaktor2|krebs";
- plugins = [
- {
- plugin = "register";
- config = {
- channels = [
- "#krebs"
- ];
- };
- }
- systemPlugin
- ];
- username = "reaktor2";
- port = "6697";
- };
r = {
nick = "reaktor2|krebs";
sendDelaySec = null;
diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix
index c6225aaa0..75be58326 100644
--- a/krebs/3modules/external/default.nix
+++ b/krebs/3modules/external/default.nix
@@ -220,6 +220,7 @@ in {
Ya8buh4RgyE/0hp4QNpa4K7fvntriK+k6zHs7BcZcG2aMWP3O9/4DgjzBR3eslQV
oou23ajP11wyfrmZK0/PQGTpsU472Jj+06KtMAaH0zo4vAR8s2kV1ukCAwEAAQ==
-----END RSA PUBLIC KEY-----
+ Ed25519PublicKey = s/HNXjzVyDiBZImQdhJqUmj7symv+po9D9uDj+/6c2F
'';
};
};
diff --git a/krebs/3modules/krebs/default.nix b/krebs/3modules/krebs/default.nix
index 37b939358..c05409fe9 100644
--- a/krebs/3modules/krebs/default.nix
+++ b/krebs/3modules/krebs/default.nix
@@ -70,6 +70,7 @@ in {
ip4.addr = "10.243.77.3";
aliases = [
"hotdog.r"
+ "agenda.r"
"build.r"
"build.hotdog.r"
"cgit.hotdog.r"
diff --git a/krebs/3modules/repo-sync.nix b/krebs/3modules/repo-sync.nix
index f9877c0f8..0312c62fd 100644
--- a/krebs/3modules/repo-sync.nix
+++ b/krebs/3modules/repo-sync.nix
@@ -149,6 +149,7 @@ let
inherit (cfg.user) home name uid;
createHome = true;
description = "repo-sync user";
+ isSystemUser = true;
};
systemd.timers = mapAttrs' (name: repo:
diff --git a/krebs/5pkgs/simple/htgen/default.nix b/krebs/5pkgs/simple/htgen/default.nix
index 9ed97242c..14b6f4c58 100644
--- a/krebs/5pkgs/simple/htgen/default.nix
+++ b/krebs/5pkgs/simple/htgen/default.nix
@@ -1,12 +1,13 @@
{ fetchgit, lib, pkgs, stdenv }:
stdenv.mkDerivation rec {
pname = "htgen";
- version = "1.3.0";
+ version = "1.3.1";
+ #src = <htgen>;
src = fetchgit {
url = "http://cgit.krebsco.de/htgen";
- rev = "refs/tags/v${version}";
- sha256 = "0p3517wkfpvip4z0axh0b4v1jm1nqpppldnhq4806c0p33vrjxnf";
+ rev = "refs/tags/${version}";
+ sha256 = "0ml8kp89bwkrwy6iqclzyhxgv2qn9dcpwaafbmsr4mgcl70zx22r";
};
installPhase = ''
diff --git a/krebs/5pkgs/simple/rss-bridge/default.nix b/krebs/5pkgs/simple/rss-bridge/default.nix
index bbe5c1bdb..e0a927a1a 100644
--- a/krebs/5pkgs/simple/rss-bridge/default.nix
+++ b/krebs/5pkgs/simple/rss-bridge/default.nix
@@ -2,13 +2,13 @@
stdenv.mkDerivation rec {
pname = "rss-bridge";
- version = "unstable-2021-01-10";
+ version = "unstable-2021-04-20";
src = fetchFromGitHub {
owner = "RSS-Bridge";
repo = "rss-bridge";
- rev = "98352845a14b9f2eb8925ad7a04a5f6cc6a5af06";
- sha256 = "1nv1f6f17cn057k9mydd3a0bmj2xa5k410fdq7nhw5b7msyxy2qv";
+ rev = "716f5ddc0e20c10cb77ded46380cc376913a92fd";
+ sha256 = "17aqmj7rz0ysk8nj4kbjvnsjdm47d0xsypfygzzk2vagxfz5w3p8";
};
patchPhase = ''
diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json
index aaf66e428..967f0b426 100644
--- a/krebs/nixpkgs-unstable.json
+++ b/krebs/nixpkgs-unstable.json
@@ -1,9 +1,9 @@
{
"url": "https://github.com/NixOS/nixpkgs",
- "rev": "fbfb79400a08bf754e32b4d4fc3f7d8f8055cf94",
- "date": "2021-06-06T04:54:09-03:00",
- "path": "/nix/store/51dsmanfc179xy70kn2rl0qvg45cn6qr-nixpkgs",
- "sha256": "0pgyx1l1gj33g5i9kwjar7dc3sal2g14mhfljcajj8bqzzrbc3za",
+ "rev": "dd14e5d78e90a2ccd6007e569820de9b4861a6c2",
+ "date": "2021-07-24T08:14:16-04:00",
+ "path": "/nix/store/0z5nrrjzmjcicjhhdrqb9vgm56zxysk3-nixpkgs",
+ "sha256": "1zmhwx1qqgl1wrrb9mjkck508887rldrnragvximhd7jrh1ya3fb",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json
index 429c23cf5..5086b8af3 100644
--- a/krebs/nixpkgs.json
+++ b/krebs/nixpkgs.json
@@ -1,9 +1,9 @@
{
"url": "https://github.com/NixOS/nixpkgs",
- "rev": "1f91fd1040667e9265a760b0347f8bc416249da7",
- "date": "2021-06-13T11:32:41+02:00",
- "path": "/nix/store/8cx16mc5cymv2ll52fs831lmd4ljzmq1-nixpkgs",
- "sha256": "1lcfcwgal9fpaiq71981abyzz160r6nx1y4pyy1dnvaf951xkdcj",
+ "rev": "91903ceb294dbe63a696759bfba3d23ee667f2dc",
+ "date": "2021-07-26T09:21:28+02:00",
+ "path": "/nix/store/2v649741xdh1crybi2dm879bl60zrkhf-nixpkgs",
+ "sha256": "1hmpwi27r4q0lnspg7ylfzxakwz2fhl3r07vjvq5yalcdqwiain3",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false