mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
95 lines
3.2 KiB
Nix
95 lines
3.2 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
...
|
|
}: 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-bin = "${pkgs.scripts.linkhandler}/bin/linkhandler";
|
|
|
|
newsboat-config = pkgs.writeText "config" ''
|
|
auto-reload no
|
|
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-bin} {}'"
|
|
browser ${linkhandler-bin}
|
|
macro , open-in-browser
|
|
macro c set browser "${pkgs.xsel}/bin/xsel -b <<<" ; open-in-browser ; set browser ${linkhandler-bin}
|
|
macro v set browser "${pkgs.utillinux}/bin/setsid -f ${pkgs.mpv}/bin/mpv" ; open-in-browser ; set browser ${linkhandler-bin}
|
|
macro y set browser "${youtube-download}" ; open-in-browser ; set browser ${linkhandler-bin}
|
|
|
|
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))" black 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 background white default
|
|
color listnormal white default
|
|
color listnormal_unread white default bold
|
|
color listfocus blue default
|
|
color listfocus_unread blue default bold
|
|
color info red default bold
|
|
color article white default
|
|
'';
|
|
in {
|
|
nixpkgs.config.packageOverrides = pkgs: {
|
|
newsboat = pkgs.writers.writeDashBin "newsboat" ''
|
|
${pkgs.newsboat}/bin/newsboat -C ${newsboat-config} -c ${newsboat-home}/cache.db -u ${newsboat-home}/urls "$@"
|
|
'';
|
|
};
|
|
|
|
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: "update"}'
|
|
else
|
|
${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db "SELECT COUNT(DISTINCT id) FROM rss_item WHERE unread=1" | ${pkgs.jq}/bin/jq '{
|
|
state: (if . > 0 then "Good" else "Idle" end),
|
|
text: . | tostring,
|
|
icon: "update"
|
|
}'
|
|
fi
|
|
'')
|
|
(pkgs.writers.writeDashBin "mpv-watch-later" ''
|
|
${pkgs.sqlite}/bin/sqlite3 ${newsboat-home}/cache.db "SELECT url FROM rss_item WHERE flags='e' AND deleted=0 ORDER BY pubDate DESC" \
|
|
| ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv
|
|
'')
|
|
];
|
|
}
|