From fb7cb091e3fa491580299e3df9143c8321996f95 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 20 Jun 2023 08:38:11 +0000 Subject: [PATCH] tuiApps: add `sfeed` --- hosts/common/programs/assorted.nix | 1 + hosts/common/programs/default.nix | 1 + hosts/common/programs/sfeed.nix | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 hosts/common/programs/sfeed.nix diff --git a/hosts/common/programs/assorted.nix b/hosts/common/programs/assorted.nix index 9223f2f3..d69d3860 100644 --- a/hosts/common/programs/assorted.nix +++ b/hosts/common/programs/assorted.nix @@ -85,6 +85,7 @@ let inherit (pkgs) aerc # email client offlineimap # email mailox sync + sfeed # RSS fetcher visidata # TUI spreadsheet viewer/editor w3m ; diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index b38f4a94..6f62e134 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -19,6 +19,7 @@ ./newsflash.nix ./offlineimap.nix ./ripgrep.nix + ./sfeed.nix ./splatmoji.nix ./steam.nix ./sublime-music.nix diff --git a/hosts/common/programs/sfeed.nix b/hosts/common/programs/sfeed.nix new file mode 100644 index 00000000..f58106c4 --- /dev/null +++ b/hosts/common/programs/sfeed.nix @@ -0,0 +1,28 @@ +# simple RSS and Atom parser +# - +# - used by sxmo +# - man 5 sfeedrc +# +# call `sfeed_update` to query each feed and populate entries in ~/.sfeed/feeds +{ lib, config, sane-lib, ... }: +let + feeds = sane-lib.feeds; + allFeeds = config.sane.feeds; + wantedFeeds = feeds.filterByFormat ["text"] allFeeds; + sfeedEntries = builtins.map (feed: + # format: + # feed [basesiteurl] [encoding] + lib.escapeShellArgs [ "feed" (if feed.title != null then feed.title else feed.url) feed.url ] + ) wantedFeeds; +in { + sane.programs.sfeed = { + fs.".sfeed/sfeedrc".symlink.text = '' + feeds() { + ${lib.concatStringsSep "\n " sfeedEntries} + } + ''; + + # this is where the parsed feed items go + persist.plaintext = [ ".sfeed/feeds" ]; + }; +}