diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/1systems/arcadeomat/config.nix | 82 | ||||
-rw-r--r-- | krebs/1systems/arcadeomat/hw.nix | 25 | ||||
-rw-r--r-- | krebs/2configs/agenda.html | 91 | ||||
-rw-r--r-- | krebs/2configs/reaktor2.nix | 154 | ||||
-rw-r--r-- | krebs/5pkgs/simple/htgen-paste/src/htgen-paste | 12 | ||||
-rw-r--r-- | krebs/5pkgs/simple/realwallpaper/default.nix | 2 | ||||
-rw-r--r-- | krebs/nixpkgs-unstable.json | 9 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 9 |
8 files changed, 158 insertions, 226 deletions
diff --git a/krebs/1systems/arcadeomat/config.nix b/krebs/1systems/arcadeomat/config.nix deleted file mode 100644 index 7439e687e..000000000 --- a/krebs/1systems/arcadeomat/config.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ config,lib, pkgs, ... }: -let - shack-ip = config.krebs.build.host.nets.shack.ip4.addr; - ext-if = "et0"; - external-mac = "52:54:b0:0b:af:fe"; - mainUser = "krebs"; - -in -{ - imports = [ - ./hw.nix - ../../../krebs - ../../../krebs/2configs - - #../../../krebs/2configs/binary-cache/nixos.nix - #../../../krebs/2configs/binary-cache/prism.nix - - ../../../krebs/2configs/shack/ssh-keys.nix - ../../../krebs/2configs/save-diskspace.nix - ../../../krebs/2configs/shack/prometheus/node.nix - - ]; - # use your own binary cache, fallback use cache.nixos.org (which is used by - # apt-cacher-ng in first place) - - # local discovery in shackspace - nixpkgs.config.packageOverrides = pkgs: { tinc = pkgs.tinc_pre; }; - krebs.tinc.retiolum.extraConfig = "TCPOnly = yes"; - - - #networking = { - # firewall.enable = false; - # firewall.allowedTCPPorts = [ 8088 8086 8083 ]; - # interfaces."${ext-if}".ipv4.addresses = [ - # { - # address = shack-ip; - # prefixLength = 20; - # } - # ]; - - # defaultGateway = "10.42.0.1"; - # nameservers = [ "10.42.0.100" "10.42.0.200" ]; - #}; - - ##################### - # uninteresting stuff - ##################### - krebs.build.host = config.krebs.hosts.arcadeomat; - users.users."${mainUser}" = { - uid = 9001; - extraGroups = [ "audio" "video" ]; - isNormalUser = true; - }; - - - time.timeZone = "Europe/Berlin"; - - # avahi - services.avahi = { - enable = true; - wideArea = false; - }; - environment.systemPackages = with pkgs;[ glxinfo sdlmame ]; - nixpkgs.config.allowUnfree = true; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_340; - boot.kernelPackages = pkgs.linuxPackages_5_4; - - services.xserver = { - videoDrivers = [ "nvidia" ]; - enable = true; - windowManager = { - awesome.enable = true; - awesome.noArgb = true; - awesome.luaModules = [ pkgs.luaPackages.vicious ]; - }; - displayManager.defaultSession = lib.mkDefault "none+awesome"; - displayManager.autoLogin = { - enable = true; - user = mainUser; - }; - }; -} diff --git a/krebs/1systems/arcadeomat/hw.nix b/krebs/1systems/arcadeomat/hw.nix deleted file mode 100644 index b24deeecb..000000000 --- a/krebs/1systems/arcadeomat/hw.nix +++ /dev/null @@ -1,25 +0,0 @@ - -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "ahci" "ohci_pci" "ehci_pci" "pata_atiixp" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/0aae456e-0548-4917-a282-11d5d4e403cf"; - fsType = "ext4"; - }; - - swapDevices = [ ]; - boot.loader.grub.enable = true; - boot.loader.grub.version = 2; - boot.loader.grub.device = "/dev/sda"; - boot.loader.grub.copyKernels = true; - -} diff --git a/krebs/2configs/agenda.html b/krebs/2configs/agenda.html new file mode 100644 index 000000000..9ccfc241c --- /dev/null +++ b/krebs/2configs/agenda.html @@ -0,0 +1,91 @@ +<!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 link = document.createElement("a"); + link.href = "http://wiki.r/agenda/" + encodeURIComponent(agendaItem.description.replaceAll("/", "\u29F8")); // we use big solidus instead of slash because gollum will create directories + link.appendChild(document.createTextNode(agendaItem.description)); + + const dd = document.createElement("dd"); + dd.className = "description"; + dd.appendChild(link); + dd.appendChild(document.createTextNode(" ")); + dd.appendChild(spanDate); + + dl.appendChild(dd); + } + }); + }) + .then((data) => console.log(data)); + </script> + </body> +</html> diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index 61b44fc27..0f7ab0adf 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -28,7 +28,7 @@ let amt=$2 unit=$3 printf '%s\n %s %d %s\n %s %d %s\n' "$(date -Id)" "$tonick" "$amt" "$unit" "$_from" "$(expr 0 - "''${amt#+}")" "$unit" >> $state_file - ${pkgs.hledger}/bin/hledger -f $state_file bal -N -O csv \ + ${pkgs.hledger}/bin/hledger -f "$state_file" bal -N -O csv \ | ${pkgs.coreutils}/bin/tail +2 \ | ${pkgs.miller}/bin/mlr --icsv --opprint cat \ | ${pkgs.gnugrep}/bin/grep "$_from" @@ -483,113 +483,49 @@ in { ''}''; }; - services.nginx = { - virtualHosts."agenda.r" = { - serverAliases = [ "kri.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 link = document.createElement("a"); - link.href = "http://wiki.r/agenda/" + encodeURIComponent(agendaItem.description.replaceAll("/", "\u29F8")); // we use big solidus instead of slash because gollum will create directories - link.appendChild(document.createTextNode(agendaItem.description)); - - const dd = document.createElement("dd"); - dd.className = "description"; - dd.appendChild(link); - 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'; - ''; + services.nginx.virtualHosts."agenda.r" = { + serverAliases = [ "kri.r" ]; + locations."= /index.html".extraConfig = '' + alias ./agenda.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'; + ''; + }; + + krebs.htgen.bedger = { + port = 8011; + user = { + name = "reaktor2"; + home = stateDir; }; + script = ''. ${pkgs.writers.writeDash "bedger" '' + case "$Method" in + "GET") + printf 'HTTP/1.1 200 OK\r\n' + printf 'Connection: close\r\n' + printf '\r\n' + ${pkgs.hledger}/bin/hledger -f ${stateDir}/ledger bal -N -O json + exit + ;; + esac + ''}''; + }; + + services.nginx.virtualHosts."hotdog.r" = { + locations."/bedger.json".extraConfig = '' + proxy_set_header Host $host; + proxy_pass http://localhost:8011; + ''; + extraConfig = '' + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + ''; }; systemd.services.reaktor2-r.serviceConfig.DynamicUser = mkForce false; @@ -597,7 +533,7 @@ in { krebs.reaktor2 = { hackint = { hostname = "irc.hackint.org"; - nick = "reaktor2|krebs"; + nick = "reaktor"; plugins = [ { plugin = "register"; @@ -617,7 +553,7 @@ in { port = "6697"; }; r = { - nick = "reaktor2|krebs"; + nick = "reaktor"; sendDelaySec = null; plugins = [ { diff --git a/krebs/5pkgs/simple/htgen-paste/src/htgen-paste b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste index 74266e53a..9d57d07ee 100644 --- a/krebs/5pkgs/simple/htgen-paste/src/htgen-paste +++ b/krebs/5pkgs/simple/htgen-paste/src/htgen-paste @@ -22,7 +22,17 @@ case "$Method $abs_path" in printf 'Connection: close\r\n' printf 'Content-Length: %d\r\n' $(wc -c < $item) printf '\r\n' - cat $item + cat "$item" + exit + fi + ;; + "DELETE /"[0-9a-z]*) + if item=$(find_item ${abs_path#/}); then + printf 'HTTP/1.1 200 OK\r\n' + printf 'Server: %s\r\n' "$Server" + printf 'Connection: close\r\n' + printf '\r\n' + rm "$item" exit fi ;; diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 544abb3a3..5364a37dc 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -275,7 +275,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' } ./get_constellations.py} ${pkgs.fetchurl { url = "https://raw.githubusercontent.com/ofrohn/d3-celestial/d2e20e104b86429d90ac8227a5b021262b45d75a/data/constellations.lines.json"; sha256 = "0g71fdrnxvxd6pcqvihj2q9iaynrl7px45kzw6qm1kymynz6ckr9"; - }} > constellations.arcs + }} > constellations.arcs || : # seems like astropy doesn't want to convert from icrs to itrs anymore xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-krebs-stars-output.png --projection merc \ diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 20bfd0ec4..4ae0716ea 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,10 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "b12803b6d90e2e583429bb79b859ca53c348b39a", - "date": "2023-07-24T08:16:24+02:00", - "path": "/nix/store/786lhas0jmp3nihbb28pbp7sm1sjzsy7-nixpkgs", - "sha256": "1l9sa8hd242xrb2j18mj4f62f3cw0bf5pafp58gdl0jkl61dpapr", + "rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28", + "date": "2023-07-28T14:55:37+02:00", + "path": "/nix/store/38nmp3rkbjic5dm6g9qp4ldwi7pr602p-nixpkgs", + "sha256": "0c2x3bcal4kyxgf6i408622zqvxamz986h11z8zjvd7gc8y4wxn7", + "hash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 4ceb87230..55e54ec64 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,10 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "98da3dd0de6660d4abed7bb74e748694bd803413", - "date": "2023-07-12T12:54:32+08:00", - "path": "/nix/store/h9ncvz7aq1aqhjmxngnnhwaw359prh2g-nixpkgs", - "sha256": "0qzflsmxfgqz07jlx7njfsq752n1la8a6007mmx7rvqspp30g6j1", + "rev": "48e82fe1b1c863ee26a33ce9bd39621d2ada0a33", + "date": "2023-07-28T18:34:19+03:00", + "path": "/nix/store/pgqfg8ip3lv0lr6mpwh558npz3c1wwcr-nixpkgs", + "sha256": "0d7na9ygda2r7gs3gbixd9gvcxgdv84993cilkj86bcwbpbg4vp5", + "hash": "sha256-5W7y1l2cLYPkpJGNlAja7XW2X2o9rjf0O1mo9nxS9jQ=", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, |