summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krebs/2configs/news.nix2
-rw-r--r--krebs/3modules/external/kmein.nix1
-rw-r--r--krebs/3modules/tinc.nix12
-rw-r--r--krebs/nixpkgs-unstable.json8
-rw-r--r--krebs/nixpkgs.json8
-rw-r--r--lass/1systems/coaxmetal/config.nix2
-rw-r--r--lass/2configs/bitcoin.nix9
-rw-r--r--lass/2configs/default.nix3
-rw-r--r--lass/2configs/radio-news.nix53
9 files changed, 76 insertions, 22 deletions
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
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 = ''
diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix
index bc85aa0a6..1b28628d6 100644
--- a/krebs/3modules/tinc.nix
+++ b/krebs/3modules/tinc.nix
@@ -19,13 +19,15 @@ with import <stockholm/lib>;
"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}
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}
'';
@@ -192,6 +194,14 @@ with import <stockholm/lib>;
'';
};
+ logLevel = mkOption {
+ type = types.int;
+ description = ''
+ LogLevel in tinc.conf
+ '';
+ default = 3;
+ };
+
user = mkOption {
type = types.user;
default = {
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,
diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json
index 22d465b27..e7760128f 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": "47cd6702934434dd02bc53a67dbce3e5493e33a2",
+ "date": "2022-03-04T16:09:08+01:00",
+ "path": "/nix/store/xbb640k873m7nmchdrnijl0f9n540ys6-nixpkgs",
+ "sha256": "1rvp9gx7n0gppc86bcysaybw79zl3y8yninsgz6rawdjprzvg7y6",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
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/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";
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 <stockholm/lib>;
time.timeZone = mkDefault"Europe/Berlin";
system.stateVersion = mkDefault "20.03";
+
+ # disable doc usually
+ documentation.nixos.enable = mkDefault false;
}
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