env: RSS populate a .opml file which can be manually imported into NewsFlash

This commit is contained in:
colin 2022-10-11 01:30:17 -07:00
parent aa6153aa56
commit 8afe0c0be5
2 changed files with 36 additions and 0 deletions

View File

@ -3,6 +3,7 @@
with lib;
{
options = {
# TODO: fold this into RSS, with an `audio` category
sane.feeds.podcastUrls = mkOption {
type = types.listOf types.str;
default = [

View File

@ -214,6 +214,7 @@ in
[qt]
qt-privacy-ask=0
'';
xdg.configFile."gpodderFeeds.opml".text =
let
entries = builtins.toString (builtins.map
@ -228,6 +229,40 @@ in
</opml>
'';
# news-flash RSS viewer
xdg.configFile."newsflashFeeds.opml".text =
let
entries = sysconfig.sane.feeds.rss;
urlsForCat = cat: builtins.filter (rss: builtins.elem cat entries."${rss}".tags) (builtins.attrNames entries);
outlineEntriesFor = cat: builtins.map (rss: ''
<outline type="rss" xmlUrl="${rss}" />
'') (urlsForCat cat);
outlineFor = cat: let
outlines = outlineEntriesFor cat;
in ''
<outline text="${cat}" title="${cat}">
${builtins.toString outlines}
</outline>
'';
outlines = [
(outlineFor "uncat")
(outlineFor "rat")
(outlineFor "tech")
(outlineFor "pol")
(outlineFor "visual")
];
in ''
<?xml version="1.0" encoding="UTF-8"?>
<opml version="2.0">
<head>
<title>NewsFlash OPML export</title>
</head>
<body>
${builtins.toString outlines}
</body>
</opml>
'';
# gnome feeds RSS viewer
xdg.configFile."org.gabmus.gfeeds.json".text = builtins.toJSON {