diff options
author | makefu <github@syntax-fehler.de> | 2021-03-19 09:17:48 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2021-03-19 09:17:48 +0100 |
commit | 8c28e9f4170d05e3e9dfb89985ce4f352cd91245 (patch) | |
tree | 82407d4e8454b3abfbb8288f8bc6765c64bf036b /krebs | |
parent | 758660945c712b645e755e9101a9fd3d8a325c91 (diff) | |
parent | 3bbbc82ae9ab9f0ac737b2ff0b55b50ae9c77b8a (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/2configs/news.nix | 62 | ||||
-rw-r--r-- | krebs/3modules/external/default.nix | 25 | ||||
-rw-r--r-- | krebs/5pkgs/haskell/X11-aeson.nix | 13 | ||||
-rw-r--r-- | krebs/5pkgs/haskell/brockman/default.nix | 4 | ||||
-rw-r--r-- | krebs/5pkgs/haskell/hack.nix | 22 | ||||
-rw-r--r-- | krebs/5pkgs/haskell/xmonad-aeson.nix | 13 | ||||
-rw-r--r-- | krebs/5pkgs/simple/realwallpaper/default.nix | 8 | ||||
-rw-r--r-- | krebs/nixpkgs-unstable.json | 8 | ||||
-rw-r--r-- | krebs/nixpkgs.json | 8 |
9 files changed, 147 insertions, 16 deletions
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix index ce4e83408..410beb041 100644 --- a/krebs/2configs/news.nix +++ b/krebs/2configs/news.nix @@ -19,12 +19,46 @@ root /var/lib/brockman; index brockman.json; ''; + extraConfig = '' + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + ''; }; }; systemd.tmpfiles.rules = [ "d /var/lib/brockman 1750 brockman nginx -" ]; + systemd.services.brockman-graph = { + path = [ + pkgs.graphviz + pkgs.jq + pkgs.inotifyTools + ]; + serviceConfig = { + ExecStart = pkgs.writers.writeDash "brockman-graph" '' + + while :; do + graphviz="$(cat /var/lib/brockman/brockman.json \ + | jq -r ' + .bots | + to_entries | + map(select(.value.extraChannels|length > 1 )) | + .[] | + "\"\(.key)\" -> {\(.value.extraChannels|map("\""+.+"\"")|join(" "))}" + ')" + echo "digraph news { $graphviz }" | circo -Tsvg > /var/lib/brockman/graph.svg + + inotifywait -q -e MODIFY /var/lib/brockman/brockman.json + done + ''; + User = "brockman"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + systemd.services.brockman.serviceConfig.LimitNOFILE = 16384; + systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG"; krebs.brockman = { enable = true; config = { @@ -53,6 +87,7 @@ "#all" "#aluhut" "#news" + "#lasstube" ]; }; } @@ -87,13 +122,36 @@ add-youtube.filename = pkgs.writeDash "add-youtube" '' set -euf if [ "$#" -ne 1 ]; then - echo 'usage: ${name}: add-youtube $nick $channelid' + echo 'usage: ${name}: add-youtube $nick $channel/video/stream/id' exit 1 fi youtube_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]') - youtube_id=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]') + youtube_url=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][1]') + if [ ''${#youtube_url} -eq 24 ]; then + youtube_id=$youtube_url + else + youtube_id=$(${pkgs.youtube-dl}/bin/youtube-dl --max-downloads 1 -j "$youtube_url" | ${pkgs.jq}/bin/jq -r '.channel_id') + fi echo "brockman: add yt_$youtube_nick http://rss.r/?action=display&bridge=Youtube&context=By+channel+id&c=$youtube_id&duration_min=&duration_max=&format=Mrss" ''; + add-twitch.filename = pkgs.writeDash "add-twitch" '' + set -euf + if [ "$#" -ne 1 ]; then + echo 'usage: ${name}: add-twitch $handle' + exit 1 + fi + twitch_nick=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]') + echo "brockman: add twitch_$twitch_nick http://rss.r/?action=display&bridge=Twitch&channel=$twitch_nick&type=all&format=Atom" + ''; + add-twitter.filename = pkgs.writeDash "add-twitter" '' + set -euf + if [ "$#" -ne 1 ]; then + echo 'usage: ${name}: add-twitter $handle' + 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" + ''; search.filename = pkgs.writeDash "search" '' set -euf if [ "$#" -ne 1 ]; then diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix index efe3ace0f..c8e360a1e 100644 --- a/krebs/3modules/external/default.nix +++ b/krebs/3modules/external/default.nix @@ -603,6 +603,30 @@ in { }; }; }; + hydrogen = { + owner = config.krebs.users.sandro; + nets = { + retiolum = { + ip4.addr = "10.243.54.54"; + aliases = [ "hydrogen.r" ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIICCgKCAgEA6bnwRKS+oWNc+ExOnJdqGHR1bnCEE9zkCqyONK3+xLg8QQIz6SvZ + Nt5cO9kdZw9rA+4Dshg5m0RSnaP2TVtiDxcyv3zAW4TSOTGaBRp9WZmwhcKyxiON + hvTBirsC1Domorew6++qHoZxtmHMKaF/uPoFLBqSvw3RHVoGzEAhGW9/LqZVa9k2 + D8dDRg7jTqH2oiIHct33Up5+zeFbmCo5xyDzl+pcwHxldi8sAupvpHx4KxXH1zMX + YQATS2Rp8b52bGEQ52UKAbSOpJqyt9/o5vb+z2JZ52N1dDrphWHGfIcJa8DVt2VO + n/V0kWuUhDh3Wwt7aIFcY0bUq4OurcVQQ5eMgwGbOEthdjLf1ou2gUJhf0zAeVQp + IiaqeHTNn1+mtxBjl4+v+b0H/lhZPSgO74Jo28fAse+/itjM3kgkIKV0ldD5tWpv + MHaKMB5Ui6swHZDV6nUxf5vlKPAM71/14cy1e/0ANFo5JvE66jWn7m5wn60HYwpB + XnTOgIxue2rJ4F+Xtm8CTgS5TcV1AKR0cnmlU7WfVOVJHD2/4QTRYYTCR53/RoVq + 1T6DILDF71H92PNylujKSPA0CKI160xJ61Xy/T6MYl5u0+RblAgYr77o5HJwmXCe + jFrCu3SKUIlJWYHWE8yNoR+VVYeXakbDFYE3KpVyBDG+ljUbia+Oel8CAwEAAQ== + -----END RSA PUBLIC KEY----- + ''; + }; + }; + }; }; users = { @@ -633,6 +657,7 @@ in { mail = "joerg@thalheim.io"; pubkey = ssh-for "mic92"; }; + sandro = {}; shannan = { mail = "shannan@lekwati.com"; pubkey = ssh-for "shannan"; diff --git a/krebs/5pkgs/haskell/X11-aeson.nix b/krebs/5pkgs/haskell/X11-aeson.nix new file mode 100644 index 000000000..7db6c28a8 --- /dev/null +++ b/krebs/5pkgs/haskell/X11-aeson.nix @@ -0,0 +1,13 @@ +{ mkDerivation, aeson, base, fetchgit, stdenv, X11 }: +mkDerivation { + pname = "X11-aeson"; + version = "1.0.0"; + src = fetchgit { + url = "https://cgit.krebsco.de/X11-aeson"; + sha256 = "0y9nvssqpvqgl46g7nz9738l8jmpa7an8r3am3qaqcvmvzgwxh0d"; + rev = "c0a70a62513baf2b437db4ebe3e5a32e3cfa5905"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ aeson base X11 ]; + license = stdenv.lib.licenses.mit; +} diff --git a/krebs/5pkgs/haskell/brockman/default.nix b/krebs/5pkgs/haskell/brockman/default.nix index 92051a025..d0cd6119e 100644 --- a/krebs/5pkgs/haskell/brockman/default.nix +++ b/krebs/5pkgs/haskell/brockman/default.nix @@ -7,12 +7,12 @@ }: mkDerivation rec { pname = "brockman"; - version = "3.4.0"; + version = "3.4.3"; src = fetchFromGitHub { owner = "kmein"; repo = "brockman"; rev = version; - sha256 = "02nval6a9xcddj6znzxvcb8g6klzjydj1lb4ych64i9mr4a8jvic"; + sha256 = "0s8rvsj5m70wijl8j00fisz6c1kms7kx12lxfgk63mrx2ldp1fb4"; }; isLibrary = false; isExecutable = true; diff --git a/krebs/5pkgs/haskell/hack.nix b/krebs/5pkgs/haskell/hack.nix new file mode 100644 index 000000000..4e157107e --- /dev/null +++ b/krebs/5pkgs/haskell/hack.nix @@ -0,0 +1,22 @@ +{ mkDerivation, base, blessings, containers, data-default, fetchgit +, lens, mtl, old-locale, process, scanner, stdenv, time, unix +, zippers +}: +mkDerivation { + pname = "hack"; + version = "1.0.0"; + src = fetchgit { + url = "https://cgit.krebsco.de/hack"; + sha256 = "0hi6frpnxbg3h6s7gd48ri57jc226qycy4rnhmpzpq195xf8y3pf"; + rev = "cb004b2e5f0fce6cea8d54e60558a1c1904dbe39"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ base ]; + executableHaskellDepends = [ + base blessings containers data-default lens mtl old-locale process + scanner time unix zippers + ]; + license = stdenv.lib.licenses.mit; +} diff --git a/krebs/5pkgs/haskell/xmonad-aeson.nix b/krebs/5pkgs/haskell/xmonad-aeson.nix new file mode 100644 index 000000000..3fccab469 --- /dev/null +++ b/krebs/5pkgs/haskell/xmonad-aeson.nix @@ -0,0 +1,13 @@ +{ mkDerivation, aeson, base, fetchgit, stdenv, X11-aeson, xmonad }: +mkDerivation { + pname = "xmonad-aeson"; + version = "1.0.0"; + src = fetchgit { + url = "https://cgit.krebsco.de/xmonad-aeson"; + sha256 = "0l1gna6p1498vzm6kj0ywj0i7775mz5n7k9nymwggvfb1pyxv3h9"; + rev = "a95f652b150f17db3f2439214a6346335d6d8d89"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ aeson base X11-aeson xmonad ]; + license = stdenv.lib.licenses.mit; +} diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index e55454a08..04a2a6718 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -100,11 +100,11 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fetch_older_min 720 ice-raw.jpg $(get_neo_url \ 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=NISE_D') & - fetch_older_days 3 snow-raw.jpg $(get_neo_url \ + fetch_older_days 1 snow-raw.jpg $(get_neo_url \ 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD10C1_E_SNOW') & - fetch_older_days 7 chlora-raw.jpg $(get_neo_url \ + fetch_older_days 1 chlora-raw.jpg $(get_neo_url \ 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MY1DMM_CHLORA') & - fetch_older_days 7 fire-raw.jpg $(get_neo_url \ + fetch_older_days 1 fire-raw.jpg $(get_neo_url \ 'https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD14A1_E_FIRE') & # regular fetches @@ -239,7 +239,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' ''} if [ -s marker.json ]; then - jq -r 'to_entries[] | @json "\(.value.latitude) \(.value.longitude) image=krebs.png"' marker.json >> marker_file + jq -r 'to_entries[] | select(.value.latitude != null) | @json "\(.value.latitude) \(.value.longitude) image=krebs.png"' marker.json >> marker_file fi xplanet --num_times 1 --geometry $xplanet_out_size \ diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 57d30799b..c0ffcf3e3 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "8c8731330b53ba0061686f36f10f101e662a4717", - "date": "2021-02-08T20:46:59+01:00", - "path": "/nix/store/agilvsqqdsqx36wf4zkq5gnhnab47qpd-nixpkgs", - "sha256": "0ak4d254myq6cl3d7jkq6n0apxabvwjz62zdw9habnrqg8asl8gk", + "rev": "266dc8c3d052f549826ba246d06787a219533b8f", + "date": "2021-03-15T09:37:03+01:00", + "path": "/nix/store/dkim3k1b5bdga370xpw0r52w0ac5y3fn-nixpkgs", + "sha256": "09ydqx2lznixmw8z4cfz1j3k137mh8n3cdpygwqymknhfdjq7lg4", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 8670999e0..837782ff6 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,9 +1,9 @@ { "url": "https://github.com/NixOS/nixpkgs", - "rev": "2394284537b89471c87065b040d3dedd8b5907fe", - "date": "2021-02-10T23:24:22+01:00", - "path": "/nix/store/rqgraycidchn5wc5mki5sqj8bl5cpx78-nixpkgs", - "sha256": "1j7vp735is5d32mbrgavpxi3fbnsm6d99a01ap8gn30n5ysd14sl", + "rev": "36e15cd6e7d55ba143caf3dc930467ace573d85c", + "date": "2021-03-16T08:18:29+01:00", + "path": "/nix/store/rsh8kmy9jiwdhsm390zw0mq1p256xzrk-nixpkgs", + "sha256": "15dwscz9s71n6hn1wml95il8hl8aza16jj9qwywps8bsdamgymfq", "fetchSubmodules": false, "deepClone": false, "leaveDotGit": false |