diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/2configs/reaktor2.nix | 165 | ||||
-rw-r--r-- | krebs/3modules/external/mic92.nix | 29 | ||||
-rw-r--r-- | krebs/nixpkgs-unstable.json | 8 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 8 |
4 files changed, 174 insertions, 36 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/mic92.nix b/krebs/3modules/external/mic92.nix index bbefb8ed8..3ef693290 100644 --- a/krebs/3modules/external/mic92.nix +++ b/krebs/3modules/external/mic92.nix @@ -334,6 +334,26 @@ in { ''; }; }; + yasmin = { + owner = config.krebs.users.mic92; + nets.retiolum = { + ip4.addr = "10.243.29.197"; + aliases = [ + "yasmin.r" + ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIIBCgKCAQEAnQ6HGgUPVQbDIsLZAawZu4vK9yHF02aDrIWU9SdzpAddhM8yqWeC + f55W6zyjZuoQ2w4UNthDl6gjQM6A9B+nEMRNz3Rnhp57Lyi0a6HZHF2Eok9vJBiu + IRbVUxPpPKOGE09w0m5cLOfDfaZVdAT+80lQYoaasDr2VlRJNa2/arzaq847/SVg + vaf4gOmE+iIK+4ZDHqLcTn1WD6jy+aMChZU/zI31vZ8vM4oPuGh1xbcB3wKP3Vf3 + OTqpGN86CdrdBahJkzNJzIXYsPsRaZ2+8dWTH9gJjI0z+yywQQCrrh9K/oJtDUHF + BwmNc150BoSLqwduSWLtBonCa9p2/y/TDQIDAQAB + -----END RSA PUBLIC KEY----- + Ed25519PublicKey = ZQt/OcrDlQZvtJyMEFcS6FKjtumBA9gBWr7VqGdbJBP + ''; + }; + }; martha = { owner = config.krebs.users.mic92; nets = rec { @@ -389,6 +409,7 @@ in { nCShp7V+MSmz4DnLK1HLksLVLmGyZmouGsLjYUnEa414EI6NJF3bfEO2ZRGaswyR /vW066YCTe7wi+YrvrMDgkdbyfn/ecMTn2iXsTb4k9/fuO0+hsqL+isCAwEAAQ== -----END RSA PUBLIC KEY----- + Ed25519PublicKey = 1wPa2cmQ4FUFw9289d0KdG1DcDuMNIYMWzIUnVVHu2P ''; }; }; @@ -426,11 +447,12 @@ in { owner = config.krebs.users.mic92; nets = rec { internet = { - ip4.addr = "131.159.38.191"; - ip6.addr = "2a09:80c0:38::191"; + ip4.addr = "131.159.102.1"; + ip6.addr = "2a09:80c0:102::1"; aliases = [ "bill.i" ]; }; retiolum = { + via = internet; addrs = [ config.krebs.hosts.bill.nets.retiolum.ip4.addr config.krebs.hosts.bill.nets.retiolum.ip6.addr @@ -465,6 +487,7 @@ in { aliases = [ "nardole.i" ]; }; retiolum = { + via = internet; addrs = [ config.krebs.hosts.nardole.nets.retiolum.ip4.addr config.krebs.hosts.nardole.nets.retiolum.ip6.addr @@ -618,6 +641,7 @@ in { FK5qRrQFMRFB8KGV+n3+cx3XCM2q0ZPTNf06N+Usx6vTKLASa/4GaTcbBx+9Dndm mFVWq9JjLa8e65tojzj8PhmgxqaNCf8aKwIDAQAB -----END RSA PUBLIC KEY----- + Ed25519PublicKey = oRGc9V9G9GFsY1bZIaJamoDEAZU2kphlpxXOMBxI2GN ''; }; }; @@ -640,6 +664,7 @@ in { jb+EGlT/vq3+oGNFJ7Shy/VsR5GLDoZ5KCsT45DM87lOjGB7m+bOdizZQtWmJtC/ /btEPWJPAD9lIY2iGtPrmeMWDNTW9c0iCwIDAQAB -----END RSA PUBLIC KEY----- + Ed25519PublicKey = dzjT09UeUGJCbUFrBo+FtbnXrsxFQnmqmJw7tjpJQJL ''; }; }; diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 967f0b426..17b0619ed 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "dd14e5d78e90a2ccd6007e569820de9b4861a6c2", - "date": "2021-07-24T08:14:16-04:00", - "path": "/nix/store/0z5nrrjzmjcicjhhdrqb9vgm56zxysk3-nixpkgs", - "sha256": "1zmhwx1qqgl1wrrb9mjkck508887rldrnragvximhd7jrh1ya3fb", + "rev": "6ef4f522d63f22b40004319778761040d3197390", + "date": "2021-08-08T17:34:03-06:00", + "path": "/nix/store/81sh4z8lwwz5z5dw3wpp715x23jis8db-nixpkgs", + "sha256": "0cz02l0mdjr5vnv0kfkiabdjc3mv26lva414ksaf3xpan3sp08s1", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 5086b8af3..07db3783f 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "91903ceb294dbe63a696759bfba3d23ee667f2dc", - "date": "2021-07-26T09:21:28+02:00", - "path": "/nix/store/2v649741xdh1crybi2dm879bl60zrkhf-nixpkgs", - "sha256": "1hmpwi27r4q0lnspg7ylfzxakwz2fhl3r07vjvq5yalcdqwiain3", + "rev": "b09c989b82f7a4f7319802a1dcf8bfe859d65362", + "date": "2021-08-09T08:34:54-07:00", + "path": "/nix/store/34dgmv9dz24n7cq836ciwibaqcdh69x4-nixpkgs", + "sha256": "0n68m06fsfgy3w6z844q5lxqdcmjlj9gx6p3zndwm6aijky0gjd8", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false |