1
0
mirror of https://github.com/kmein/niveum synced 2026-03-18 02:51:08 +01:00

2 Commits

Author SHA1 Message Date
ce7fd6074b miniflux: add random unread script 2024-08-14 06:40:51 +02:00
297b3aba37 ful: host brockman 2024-08-14 06:40:24 +02:00
6 changed files with 434 additions and 164 deletions

View File

@@ -1,118 +1,17 @@
{
pkgs,
config,
lib,
...
}: let
ytdl-format = "'bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best'";
youtube-download = "${pkgs.ts}/bin/ts ${pkgs.yt-dlp}/bin/yt-dlp -f ${ytdl-format} --add-metadata";
newsboat-home = "${config.users.users.me.home}/cloud/Seafile/Documents/newsboat";
linkhandler = pkgs.writers.writeDash "linkhandler" ''
# Feed script a url or file location.
# If an image, it will view in sxiv,
# if a video or gif, it will view in mpv
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
# If no url given. Opens browser. For using script as $BROWSER.
[ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f ${pkgs.mpv}/bin/mpv -quiet "$1" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;;
*)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1"
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
esac
'';
newsboat-config = pkgs.writeText "config" ''
auto-reload no
reload-threads 8
prepopulate-query-feeds yes
# dont keep a search history
history-limit 0
datetime-format %F
text-width 85
external-url-viewer "${pkgs.urlscan}/bin/urlscan -dc -r '${linkhandler} {}'"
browser ${linkhandler}
macro , open-in-browser
macro c set browser "${pkgs.xsel}/bin/xsel -b <<<" ; open-in-browser ; set browser ${linkhandler}
macro v set browser "${pkgs.util-linux}/bin/setsid -f ${pkgs.mpv}/bin/mpv" ; open-in-browser ; set browser ${linkhandler}
macro y set browser "${youtube-download}" ; open-in-browser ; set browser ${linkhandler}
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key J next-feed articlelist
bind-key K prev-feed articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key l open
bind-key h quit
bind-key a toggle-article-read
bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U show-urls
bind-key x pb-delete
save-path ${newsboat-home}/saved/
highlight all "---.*---" yellow default
# highlight feedlist ".*(0/0))" default default
highlight article "^Title:.*" yellow default bold
highlight article "^Author:.*" yellow default
highlight article "^Flags:.*" red default
highlight article "\\[[0-9][0-9]*\\]" color66 default bold
highlight article "\\[image [0-9][0-9]*\\]" color109 default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" color66 default bold
color listfocus blue default
color listfocus_unread blue default bold
color info red default bold
urls-source "miniflux"
miniflux-url "https://feed.kmein.de"
miniflux-login "kfm"
miniflux-password "${lib.strings.fileContents <secrets/miniflux/password>}"
'';
newsboat-sql = "${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db";
in {
}: {
environment.systemPackages = [
pkgs.newsboat
(pkgs.writers.writeDashBin "newsboat-unread-count" ''
if [ -f ${newsboat-home}/cache.db.lock ]; then
${pkgs.jq}/bin/jq -n '{state: "Info", text: "", icon: "rss"}'
else
${pkgs.jq}/bin/jq -n \
--argjson unread "$(${newsboat-sql} "SELECT COUNT(DISTINCT id) FROM rss_item WHERE unread=1")" \
--argjson watchLater "$(${newsboat-sql} "SELECT COUNT(DISTINCT id) FROM rss_item WHERE flags='e' AND deleted=0")" \
'{
state: (if $unread > 0 then "Good" else "Idle" end),
text: (if $unread > 0 then "\($unread)" else "[\($watchLater)]" end),
icon: "rss"
}'
fi
'')
(pkgs.writers.writeDashBin "mpv-watch-later" ''
${newsboat-sql} "SELECT url FROM rss_item WHERE flags='e' AND deleted=0 ORDER BY pubDate DESC" \
| ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv
(pkgs.writers.writeDashBin "miniflux-watch-later" ''
miniflux_api_token=$(cat ${config.age.secrets.miniflux-api-token.path})
random_feed_item=$(
${pkgs.curl}/bin/curl -u "$miniflux_api_token" --basic -s 'https://feed.kmein.de/v1/entries?starred=true&limit=0' \
| ${pkgs.jq}/bin/jq -r '.entries[].id' \
| ${pkgs.coreutils}/bin/shuf -n1
)
${pkgs.xdg-utils}/bin/xdg-open "https://feed.kmein.de/starred/entry/$random_feed_item"
'')
];
}

292
flake.lock generated
View File

@@ -217,6 +217,48 @@
"url": "https://cgit.krebsco.de/blessings"
}
},
"brockman": {
"inputs": {
"nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1723574076,
"narHash": "sha256-3xY2J/UVrLe0kg/dnZkkzbvV4t/SJrZS3mUvNV4F2Xg=",
"owner": "kmein",
"repo": "brockman",
"rev": "3e8d17466a04b747dc6262cbcbba1c04fd955999",
"type": "github"
},
"original": {
"owner": "kmein",
"repo": "brockman",
"type": "github"
}
},
"buildbot-nix": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"stockholm",
"nixpkgs"
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1719326738,
"narHash": "sha256-9gEgR/teWxH1E3JUUunLrcgOpMel19nw//eK3XKU6RQ=",
"owner": "Mic92",
"repo": "buildbot-nix",
"rev": "6e342155745f68b6d7ccc5557fa3d320b8aa3273",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "buildbot-nix",
"type": "github"
}
},
"coptic-dictionary": {
"inputs": {
"kellia-dictionary": "kellia-dictionary",
@@ -310,7 +352,7 @@
},
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs_4",
"nixpkgs": "nixpkgs_5",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
@@ -359,6 +401,28 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"stockholm",
"buildbot-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1717285511,
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
@@ -604,7 +668,7 @@
"inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_5"
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1702906210,
@@ -688,7 +752,7 @@
"menstruation-telegram": "menstruation-telegram",
"nix-on-droid": "nix-on-droid",
"nixinate": "nixinate",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixpkgs-old": "nixpkgs-old",
"nixpkgs-unstable": "nixpkgs-unstable",
"nur": "nur",
@@ -823,6 +887,22 @@
"type": "github"
}
},
"nix-writers": {
"flake": false,
"locked": {
"lastModified": 1677612737,
"narHash": "sha256-UaCKZ4PbMZU6UZH7XNFcjRtd5jheswl66rjZDBfQgp8=",
"ref": "refs/heads/master",
"rev": "66a1f6833464bbb121b6d94247ad769f277351f8",
"revCount": 39,
"type": "git",
"url": "https://cgit.krebsco.de/nix-writers"
},
"original": {
"type": "git",
"url": "https://cgit.krebsco.de/nix-writers"
}
},
"nixinate": {
"inputs": {
"nixpkgs": [
@@ -847,7 +927,7 @@
},
"nixinate_2": {
"inputs": {
"nixpkgs": "nixpkgs_6"
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1708891350,
@@ -863,18 +943,54 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1636849918,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"brockman",
"nixpkgs"
]
},
"locked": {
"lastModified": 1653339081,
"narHash": "sha256-dpim9Mtd57Yj6qt7p7UKwjWm6NnOU3S7jaEyEscSyPE=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "fb3ee0f618b8c80dea1239691b15dfeb4bb46331",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1693636127,
"narHash": "sha256-ZlS/lFGzK7BJXX2YVGnP3yZi3T9OLOEtBCyMJsb91U8=",
"lastModified": 1654012153,
"narHash": "sha256-In+gfoH2Tnf/UmpzeuGlfuexU2EC4QIelBsm2zMK5AE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9075cba53e86dc318d159aee55dc9a7c9a4829c1",
"rev": "49a2bcc6e2065909c701f862f9a1a62b3082b40a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
@@ -975,7 +1091,7 @@
"type": "github"
}
},
"nixpkgs_2": {
"nixpkgs_10": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
@@ -991,7 +1107,7 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_11": {
"locked": {
"lastModified": 1615532953,
"narHash": "sha256-SWpaGjrp/INzorEqMz3HLi6Uuk9I0KAn4YS8B4n3q5g=",
@@ -1004,22 +1120,51 @@
"type": "indirect"
}
},
"nixpkgs_4": {
"nixpkgs_2": {
"locked": {
"lastModified": 1701436327,
"narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=",
"owner": "nixos",
"lastModified": 1693636127,
"narHash": "sha256-ZlS/lFGzK7BJXX2YVGnP3yZi3T9OLOEtBCyMJsb91U8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "91050ea1e57e50388fa87a3302ba12d188ef723a",
"rev": "9075cba53e86dc318d159aee55dc9a7c9a4829c1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1615532953,
"narHash": "sha256-SWpaGjrp/INzorEqMz3HLi6Uuk9I0KAn4YS8B4n3q5g=",
"path": "/nix/store/vw365chp87kvfczxm26qiq7z2pq3jk5z-source",
"rev": "916ee862e87ac5ee2439f2fb7856386b4dc906ae",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1701436327,
@@ -1037,6 +1182,22 @@
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1701436327,
"narHash": "sha256-tRHbnoNI8SIM5O5xuxOmtSLnswEByzmnQcGGyNRjxsE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "91050ea1e57e50388fa87a3302ba12d188ef723a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": {
"lastModified": 1653060744,
"narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=",
@@ -1052,7 +1213,7 @@
"type": "github"
}
},
"nixpkgs_7": {
"nixpkgs_8": {
"locked": {
"lastModified": 1721821769,
"narHash": "sha256-PhmkdTJs2SfqKzSyDB74rDKp1MH4mGk0pG/+WqrnGEw=",
@@ -1068,33 +1229,20 @@
"type": "github"
}
},
"nixpkgs_8": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_9": {
"locked": {
"lastModified": 1615532953,
"narHash": "sha256-SWpaGjrp/INzorEqMz3HLi6Uuk9I0KAn4YS8B4n3q5g=",
"path": "/nix/store/vw365chp87kvfczxm26qiq7z2pq3jk5z-source",
"rev": "916ee862e87ac5ee2439f2fb7856386b4dc906ae",
"type": "path"
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": {
@@ -1292,11 +1440,11 @@
},
"retiolum_2": {
"locked": {
"lastModified": 1719907580,
"narHash": "sha256-arE8H5HXoPwcjQXnUH1pmnh2pi37+5hXjo4UPpYJ7FY=",
"lastModified": 1723579214,
"narHash": "sha256-YKzjA2J1io2FR6Y1ZS98jKDLnxWKnJXq4ITto93e5Zg=",
"ref": "refs/heads/master",
"rev": "7e5194b7aba337bc06b5a33738284ef98eef6cbf",
"revCount": 342,
"rev": "be646cb8778ad3dd11a5f9227bc3b8ae4338d46f",
"revCount": 344,
"type": "git",
"url": "https://git.thalheim.io/Mic92/retiolum"
},
@@ -1308,6 +1456,7 @@
"root": {
"inputs": {
"agenix": "agenix",
"brockman": "brockman",
"coptic-dictionary": "coptic-dictionary",
"flake-utils": "flake-utils_3",
"home-manager": "home-manager_2",
@@ -1315,7 +1464,7 @@
"menstruation-telegram": "menstruation-telegram_2",
"nix-on-droid": "nix-on-droid_2",
"nixinate": "nixinate_2",
"nixpkgs": "nixpkgs_7",
"nixpkgs": "nixpkgs_8",
"nixpkgs-old": "nixpkgs-old_2",
"nixpkgs-unstable": "nixpkgs-unstable_2",
"nur": "nur_2",
@@ -1323,6 +1472,7 @@
"retiolum": "retiolum_2",
"rust-overlay": "rust-overlay_2",
"scripts": "scripts_2",
"stockholm": "stockholm",
"stylix": "stylix_2",
"telebots": "telebots_2",
"tinc-graph": "tinc-graph_2",
@@ -1453,6 +1603,26 @@
"type": "github"
}
},
"stockholm": {
"inputs": {
"buildbot-nix": "buildbot-nix",
"nix-writers": "nix-writers",
"nixpkgs": "nixpkgs_9"
},
"locked": {
"lastModified": 1723572242,
"narHash": "sha256-DncjL8LAZq9BpoBpih6NCzLtaHfSgGlFBBJeSQprkbI=",
"owner": "krebs",
"repo": "stockholm",
"rev": "06183f2a8723997c1ff066ec45f027dfe09b3474",
"type": "github"
},
"original": {
"owner": "krebs",
"repo": "stockholm",
"type": "github"
}
},
"stylix": {
"inputs": {
"base16": "base16",
@@ -1579,7 +1749,7 @@
"telebots": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1677156381,
@@ -1598,7 +1768,7 @@
"telebots_2": {
"inputs": {
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_8"
"nixpkgs": "nixpkgs_10"
},
"locked": {
"lastModified": 1703313352,
@@ -1672,6 +1842,28 @@
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"stockholm",
"buildbot-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1718522839,
"narHash": "sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "68eb1dc333ce82d0ab0c0357363ea17c31ea1f81",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"voidrice": {
"flake": false,
"locked": {
@@ -1711,7 +1903,7 @@
"niveum",
"flake-utils"
],
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1615819231,
@@ -1733,7 +1925,7 @@
"flake-utils": [
"flake-utils"
],
"nixpkgs": "nixpkgs_9"
"nixpkgs": "nixpkgs_11"
},
"locked": {
"lastModified": 1615819231,

View File

@@ -3,6 +3,7 @@
inputs = {
agenix.url = "github:ryantm/agenix";
brockman.url = "github:kmein/brockman";
coptic-dictionary.url = "github:kmein/coptic-dictionary";
flake-utils.url = "github:numtide/flake-utils";
home-manager.url = "github:nix-community/home-manager/release-24.05";
@@ -16,6 +17,7 @@
nur.url = "github:nix-community/NUR";
recht.url = "github:kmein/recht";
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
stockholm.url = "github:krebs/stockholm";
rust-overlay.url = "github:oxalica/rust-overlay";
scripts.url = "github:kmein/scripts";
stylix.url = "github:danth/stylix/release-24.05";
@@ -63,6 +65,7 @@
nixpkgs,
nixpkgs-unstable,
nur,
brockman,
home-manager,
agenix,
retiolum,
@@ -205,8 +208,11 @@
inputs.self.nixosModules.passport
inputs.self.nixosModules.panoptikon
inputs.self.nixosModules.htgen
inputs.stockholm.nixosModules.reaktor2
brockman.nixosModule
retiolum.nixosModules.retiolum
nur.nixosModules.nur
{ nixpkgs.overlays = [ inputs.stockholm.overlays.default ]; }
{
_module.args.nixinate = {
host = "ful";

176
systems/ful/brockman.nix Normal file
View File

@@ -0,0 +1,176 @@
{ pkgs, ... }:
{
services.rss-bridge = {
enable = true;
config.system.enabled_bridges = [ "*" ];
};
services.nginx.virtualHosts = {
rss-bridge = {
serverAliases = [
"rss.r"
];
};
"brockman.r" = {
serverAliases = [
"news.r"
];
locations."/api".extraConfig = ''
proxy_pass http://127.0.0.1:7777/;
proxy_pass_header Server;
'';
locations."/".extraConfig = ''
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 -"
"d /run/irc-api 1750 brockman nginx -"
];
networking.firewall.allowedTCPPorts = [6667];
services.ergochat.enable = true;
services.ergochat.openFilesLimit = 16384;
services.ergochat.settings = {
limits.nicklen = 100;
limits.identlen = 100;
history.enabled = false;
};
systemd.services.brockman.bindsTo = [ "ergochat.service" ];
systemd.services.brockman.serviceConfig.LimitNOFILE = 16384;
systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG";
services.brockman = {
enable = true;
config = {
irc.host = "localhost";
channel = "#all";
shortener = "http://go.r";
controller = {
nick = "brockman";
extraChannels = [ "#all" ];
};
statePath = "/var/lib/brockman/brockman.json";
bots = {};
};
};
krebs.reaktor2.api = {
hostname = "localhost";
port = "6667";
nick = "api";
API.listen = "inet://127.0.0.1:7777";
plugins = [
{
plugin = "register";
config = {
channels = [
"#all"
];
};
}
];
};
krebs.reaktor2.news = let
name = "candyman";
in {
hostname = "localhost";
port = "6667";
nick = name;
plugins = [
{
plugin = "register";
config = {
channels = [
"#all"
"#aluhut"
"#news"
"#lasstube"
];
};
}
{
plugin = "system";
config = {
hooks.PRIVMSG = [
{
activate = "match";
pattern = "^${name}:\\s*(\\S*)(?:\\s+(.*\\S))?\\s*$";
command = 1;
arguments = [2];
commands = {
add-reddit.filename = pkgs.writers.writeDash "add-reddit" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-reddit $reddit_channel'
exit 1
fi
reddit_channel=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add r_$reddit_channel http://rss.r/?action=display&bridge=Reddit&context=single&r=$reddit_channel&format=Atom"
'';
add-telegram.filename = pkgs.writers.writeDash "add-telegram" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: add-telegram $telegram_user'
exit 1
fi
telegram_user=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
echo "brockman: add t_$telegram_user http://rss.r/?action=display&bridge=Telegram&username=$telegram_user&format=Mrss"
'';
add-youtube.filename = pkgs.writers.writeDash "add-youtube" ''
set -euf
if [ "$#" -ne 1 ]; then
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_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.yt-dlp}/bin/yt-dlp --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.writers.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.writers.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=Twitter&context=By+username&u=$twitter_nick&norep=on&noretweet=on&nopinned=on&nopic=on&format=Atom"
'';
search.filename = pkgs.writers.writeDash "search" ''
set -euf
if [ "$#" -ne 1 ]; then
echo 'usage: ${name}: search $searchterm'
exit 1
fi
searchterm=$(echo "$1" | ${pkgs.jq}/bin/jq -Rr '[match("(\\S+)\\s*";"g").captures[].string][0]')
${pkgs.curl}/bin/curl -Ss "https://feedsearch.dev/api/v1/search?url=$searchterm&info=true&favicon=false" |
${pkgs.jq}/bin/jq '.[].url'
'';
};
}
];
};
}
];
};
}

View File

@@ -12,6 +12,7 @@ in {
./radio.nix
./panoptikon.nix
./hledger.nix
./brockman.nix
../../configs/monitoring.nix
../../configs/tor.nix
../../configs/save-space.nix

View File

@@ -97,10 +97,6 @@ in {
autoconnect = true;
addresses = "news.r";
autojoin = ["#cook" "#drachengame" "#oepnv" "#kmeinung" "#memes"];
command = "/oper aids balls";
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = nick + nick;
};
};
};