From 639472d948f5da119c791f5ff80c1c150b1bf98b Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 20 Feb 2022 00:19:23 +0100 Subject: l radio-news: add api endpoint --- lass/2configs/radio-news.nix | 53 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/lass/2configs/radio-news.nix b/lass/2configs/radio-news.nix index a4e28c1b1..eb7d3bd9a 100644 --- a/lass/2configs/radio-news.nix +++ b/lass/2configs/radio-news.nix @@ -1,8 +1,8 @@ -{ config, pkgs, ... }: with pkgs.stockholm.lib; +{ config, lib, pkgs, ... }: let weather_report = pkgs.writers.writeDashBin "weather_report" '' set -efu - ${pkgs.curl}/bin/curl -sSL https://wttr.in/''${1-}?format=j1 \ + ${pkgs.curl}/bin/curl -fsSL https://wttr.in/''${1-}?format=j1 \ | ${pkgs.jq}/bin/jq -r ' [.nearest_area[0] | "Weather report for \(.areaName[0].value), \(.country[0].value)."] + [.current_condition[0] | "Currently it is \(.weatherDesc[0].value) outside with a temperature of \(.temp_C) degrees."] @@ -14,11 +14,25 @@ let ${pkgs.libshout}/bin/shout --format ogg --host localhost --port 1338 --mount /live ''; + gc_news = pkgs.writers.writeDashBin "gc_news" '' + set -xefu + ${pkgs.coreutils}/bin/cat $HOME/news | ${pkgs.jq}/bin/jq -cs 'map(select((.to|fromdateiso8601) > now)) | .[]' > $HOME/bla-news.tmp + ${pkgs.coreutils}/bin/mv $HOME/bla-news.tmp $HOME/news + ''; + + get_current_news = pkgs.writers.writeDashBin "get_current_news" '' + set -xefu + ${pkgs.coreutils}/bin/cat $HOME/news | ${pkgs.jq}/bin/jq -rs 'map(select(((.to | fromdateiso8601) > now) and (.from|fromdateiso8601) < now) | .text) | .[]' + ''; + newsshow = pkgs.writers.writeDashBin "newsshow" /* sh */ '' echo " hello crabpeople! $(${pkgs.ddate}/bin/ddate | sed 's/YOLD/Year of Discord/')! It is $(date --utc +%H) o clock UTC. + todays news: + $(get_current_news) + $(gc_news) $(weather_report berlin) $(weather_report 70173) $(weather_report munich) @@ -30,6 +44,8 @@ in path = [ newsshow send_to_radio + gc_news + get_current_news weather_report pkgs.curl pkgs.retry @@ -37,10 +53,41 @@ in script = '' set -efu retry -t 5 -d 10 -- newsshow | - retry -t 5 -d 10 -- curl -SsG http://tts.r/api/tts --data-urlencode 'text@-' | + retry -t 5 -d 10 -- curl -fSsG http://tts.r/api/tts --data-urlencode 'text@-' | retry -t 5 -d 10 -- send_to_radio ''; startAt = "*:00:00"; + serviceConfig = { + User = "radio-news"; + }; + }; + + krebs.iptables.tables.filter.INPUT.rules = [ + { predicate = "-p tcp --dport 7999"; target = "ACCEPT"; } + ]; + + krebs.htgen.news = { + port = 7999; + user = { + name = "radio-news"; + }; + script = ''. ${pkgs.writers.writeDash "htgen-news" '' + set -xefu + case "$Method $Request_URI" in + "POST /") + payload=$(head -c "$req_content_length" \ + | sed 's/+/ /g;s/%\(..\)/\\x\1/g;' \ + | xargs -0 echo -e \ + ) + echo "$payload" | jq 'has("from") and has("to") and has("text")' >&2 + echo "$payload" | jq -c '{ from: (.from | fromdate | todate), to: (.to | fromdate | todate), text: .text }' >> $HOME/news + printf 'HTTP/1.1 200 OK\r\n' + printf 'Connection: close\r\n' + printf '\r\n' + exit + ;; + esac + ''}''; }; ## debug -- cgit v1.2.3 From 04f550493171d8091598791796035e365b87fe7c Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 20 Feb 2022 15:05:21 +0100 Subject: news: fix add_twitter command --- krebs/2configs/news.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix index 9ea4cbf8d..1f966bf24 100644 --- a/krebs/2configs/news.nix +++ b/krebs/2configs/news.nix @@ -184,7 +184,7 @@ exit 1 fi twitter_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]') - echo "brockman: add tw_$twitter_nick http://rss.r/?action=display&bridge=Twitch&channel=$twitter_nick&type=all&format=Atom" + echo "brockman: add tw_$twitter_nick http://rss.r/?action=display&bridge=Twitter&context=By+username&u=$twitter_nick&norep=on&noretweet=on&nopinned=on&nopic=on&format=Atom" ''; search.filename = pkgs.writeDash "search" '' set -euf -- cgit v1.2.3 From c88b48f0266ebfffd1bfd5ea2045f01cb15760b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 22 Feb 2022 20:32:16 +0100 Subject: external: add redaktion.r --- krebs/3modules/external/kmein.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/krebs/3modules/external/kmein.nix b/krebs/3modules/external/kmein.nix index 1e4a68057..4605fbdf0 100644 --- a/krebs/3modules/external/kmein.nix +++ b/krebs/3modules/external/kmein.nix @@ -63,6 +63,7 @@ in "names.kmein.r" "graph.r" "rrm.r" + "redaktion.r" ]; ip4.addr = "10.243.2.84"; tinc.pubkey = '' -- cgit v1.2.3 From a51abfa5b975f932211e2c5a46c1096a65cf481f Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 26 Feb 2022 12:07:12 +0100 Subject: nixpkgs: 521e4d7 -> 4275a32 --- krebs/nixpkgs.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 22d465b27..c9b40c10f 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "521e4d7d13b09bc0a21976b9d19abd197d4e3b1e", - "date": "2022-02-07T00:29:53+00:00", - "path": "/nix/store/pvmrsiy8k37nwg18g7230g5kasbsf132-nixpkgs", - "sha256": "156b4wnm6y6lg0gz09mp48rd0mhcdazr5s888c4lbhlpn3j8h042", + "rev": "4275a321beab5a71872fb7a5fe5da511bb2bec73", + "date": "2022-02-23T13:42:45-08:00", + "path": "/nix/store/g521qhbql6116naa3fjgga6dm0r24ynx-nixpkgs", + "sha256": "1p3pn7767ifbg08nmgjd93iqk0z87z4lv29ypalj9idwd3chsm69", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, -- cgit v1.2.3 From f0a47ab3b254ceb4eb08f4ee8986748bb3496e4f Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 26 Feb 2022 12:07:45 +0100 Subject: nixpkgs-unstable: 60c52a7 -> 7f9b6e2 --- krebs/nixpkgs-unstable.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 12afe0e9c..71367c2f1 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "60c52a73f1d5858020ac4f161cd5bf1c9650f8b8", - "date": "2022-02-07T23:59:33+00:00", - "path": "/nix/store/5w1yn77d2b44wq0w7b8cqqqfap2897n2-nixpkgs", - "sha256": "1xyi4xag084ikcbis3iixpvfsmlfm2s105j58770x7k24mkrif7n", + "rev": "7f9b6e2babf232412682c09e57ed666d8f84ac2d", + "date": "2022-02-21T09:47:16+01:00", + "path": "/nix/store/4vd9z4b2s4jfn96ypdfavizy6908l71h-nixpkgs", + "sha256": "03nb8sbzgc3c0qdr1jbsn852zi3qp74z4qcy7vrabvvly8rbixp2", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, -- cgit v1.2.3 From a67ded588b45c09ca58a3b4007a8d32e42323613 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 26 Feb 2022 14:06:02 +0100 Subject: l bch: RIP --- lass/2configs/bitcoin.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lass/2configs/bitcoin.nix b/lass/2configs/bitcoin.nix index 9aa97a8ce..de6562cbc 100644 --- a/lass/2configs/bitcoin.nix +++ b/lass/2configs/bitcoin.nix @@ -5,15 +5,6 @@ let in { users.extraUsers = { - bch = { - name = "bch"; - description = "user for bch stuff"; - home = "/home/bch"; - useDefaultShell = true; - createHome = true; - packages = [ pkgs.electron-cash ]; - isNormalUser = true; - }; bitcoin = { name = "bitcoin"; description = "user for bitcoin stuff"; -- cgit v1.2.3 From 6002189225e347418f07a99d6a85b033fa0edaf7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 1 Mar 2022 14:20:57 +0100 Subject: tinc tinc-up: don't rely on store path interpreter --- krebs/3modules/tinc.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index bc85aa0a6..e9d1b30ae 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -25,7 +25,8 @@ with import ; Port = ${toString tinc.config.host.nets.${netname}.tinc.port} ${tinc.config.extraConfig} ''; - "tinc-up" = pkgs.writeDash "${netname}-tinc-up" '' + "tinc-up" = pkgs.writeScript "${netname}-tinc-up" '' + #!/bin/sh ip link set ${netname} up ${tinc.config.tincUp} ''; -- cgit v1.2.3 From 87a44dd1573cbdc8f0fc3553b0896b470bcfa44d Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 3 Mar 2022 10:53:25 +0100 Subject: tinc: add logLevel with default of 3 --- krebs/3modules/tinc.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index e9d1b30ae..1b28628d6 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -19,6 +19,7 @@ with import ; "hosts" = tinc.config.hostsPackage; "tinc.conf" = pkgs.writeText "${netname}-tinc.conf" '' Name = ${tinc.config.host.name} + LogLevel = ${toString tinc.config.logLevel} Interface = ${netname} Broadcast = no ${concatMapStrings (c: "ConnectTo = ${c}\n") tinc.config.connectTo} @@ -193,6 +194,14 @@ with import ; ''; }; + logLevel = mkOption { + type = types.int; + description = '' + LogLevel in tinc.conf + ''; + default = 3; + }; + user = mkOption { type = types.user; default = { -- cgit v1.2.3 From 7e2c72e51d1b64e061131294b2fc62a562c4f218 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 6 Mar 2022 18:36:40 +0100 Subject: nixpkgs: 4275a32 -> 47cd670 --- krebs/nixpkgs.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index c9b40c10f..e7760128f 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "4275a321beab5a71872fb7a5fe5da511bb2bec73", - "date": "2022-02-23T13:42:45-08:00", - "path": "/nix/store/g521qhbql6116naa3fjgga6dm0r24ynx-nixpkgs", - "sha256": "1p3pn7767ifbg08nmgjd93iqk0z87z4lv29ypalj9idwd3chsm69", + "rev": "47cd6702934434dd02bc53a67dbce3e5493e33a2", + "date": "2022-03-04T16:09:08+01:00", + "path": "/nix/store/xbb640k873m7nmchdrnijl0f9n540ys6-nixpkgs", + "sha256": "1rvp9gx7n0gppc86bcysaybw79zl3y8yninsgz6rawdjprzvg7y6", "fetchLFS": false, "fetchSubmodules": false, "deepClone": false, -- cgit v1.2.3 From 97dc81c31e56901a2c8702dcf6cb474338123ec2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 9 Mar 2022 21:27:50 +0100 Subject: l: build doc only on coaxmetal.r --- lass/1systems/coaxmetal/config.nix | 2 ++ lass/2configs/default.nix | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lass/1systems/coaxmetal/config.nix b/lass/1systems/coaxmetal/config.nix index 0e6bddf5e..dd8308bbd 100644 --- a/lass/1systems/coaxmetal/config.nix +++ b/lass/1systems/coaxmetal/config.nix @@ -66,4 +66,6 @@ enable = true; client.enable = true; }; + + documentation.nixos.enable = true; } diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index e2163b688..f03d8b568 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -221,4 +221,7 @@ with import ; time.timeZone = mkDefault"Europe/Berlin"; system.stateVersion = mkDefault "20.03"; + + # disable doc usually + documentation.nixos.enable = mkDefault false; } -- cgit v1.2.3