feeds: convert to ordinary nix expression instead of config/options

there's no real reason for it to be externally configurable at this
level.
This commit is contained in:
2022-10-14 09:02:50 -07:00
parent e023f48c52
commit b25f270f48
3 changed files with 114 additions and 124 deletions

View File

@@ -2,7 +2,6 @@
{ {
imports = [ imports = [
./feeds.nix
./home-manager.nix ./home-manager.nix
./home-packages.nix ./home-packages.nix
./system-packages.nix ./system-packages.nix

View File

@@ -1,131 +1,121 @@
{ lib, ... }:
with lib;
{ {
options = { # TODO: fold this into RSS, with an `audio` category
# TODO: fold this into RSS, with an `audio` category podcastUrls = [
sane.feeds.podcastUrls = mkOption { "https://lexfridman.com/feed/podcast/"
type = types.listOf types.str; ## Astral Codex Ten
default = [ "http://feeds.libsyn.com/108018/rss"
"https://lexfridman.com/feed/podcast/" ## Econ Talk
## Astral Codex Ten "https://feeds.simplecast.com/wgl4xEgL"
"http://feeds.libsyn.com/108018/rss" ## Cory Doctorow
## Econ Talk "https://feeds.feedburner.com/doctorow_podcast"
"https://feeds.simplecast.com/wgl4xEgL" "https://congressionaldish.libsyn.com/rss"
## Cory Doctorow ## Civboot
"https://feeds.feedburner.com/doctorow_podcast" "https://anchor.fm/s/34c7232c/podcast/rss"
"https://congressionaldish.libsyn.com/rss" "https://feeds.feedburner.com/80000HoursPodcast"
## Civboot "https://allinchamathjason.libsyn.com/rss"
"https://anchor.fm/s/34c7232c/podcast/rss" "https://acquired.libsyn.com/rss"
"https://feeds.feedburner.com/80000HoursPodcast" "https://rss.acast.com/deconstructed"
"https://allinchamathjason.libsyn.com/rss" ## The Daily
"https://acquired.libsyn.com/rss" "https://feeds.simplecast.com/54nAGcIl"
"https://rss.acast.com/deconstructed" "https://rss.acast.com/intercepted-with-jeremy-scahill"
## The Daily "https://podcast.posttv.com/itunes/post-reports.xml"
"https://feeds.simplecast.com/54nAGcIl" ## Eric Weinstein
"https://rss.acast.com/intercepted-with-jeremy-scahill" "https://rss.art19.com/the-portal"
"https://podcast.posttv.com/itunes/post-reports.xml" "https://feeds.megaphone.fm/darknetdiaries"
## Eric Weinstein "http://feeds.wnyc.org/radiolab"
"https://rss.art19.com/the-portal" "https://wakingup.libsyn.com/rss"
"https://feeds.megaphone.fm/darknetdiaries" ## 99% Invisible
"http://feeds.wnyc.org/radiolab" "https://feeds.simplecast.com/BqbsxVfO"
"https://wakingup.libsyn.com/rss" "https://rss.acast.com/ft-tech-tonic"
## 99% Invisible "https://feeds.feedburner.com/dancarlin/history?format=xml"
"https://feeds.simplecast.com/BqbsxVfO" ## 60 minutes (NB: this features more than *just* audio?)
"https://rss.acast.com/ft-tech-tonic" "https://www.cbsnews.com/latest/rss/60-minutes"
"https://feeds.feedburner.com/dancarlin/history?format=xml" ];
## 60 minutes (NB: this features more than *just* audio?)
"https://www.cbsnews.com/latest/rss/60-minutes"
];
};
sane.feeds.rss = mkOption { rss =
type = types.attrs; let
default = let hourly = { freq = "hourly"; };
hourly = { freq = "hourly"; }; daily = { freq = "daily"; };
daily = { freq = "daily"; }; weekly = { freq = "weekly"; };
weekly = { freq = "weekly"; }; infrequent = { freq = "infrequent"; };
infrequent = { freq = "infrequent"; }; rat = { cat = "rat"; };
rat = { cat = "rat"; }; tech = { cat = "tech"; };
tech = { cat = "tech"; }; pol = { cat = "pol"; };
pol = { cat = "pol"; }; uncat = { cat = "uncat"; };
uncat = { cat = "uncat"; }; visual = { cat = "visual"; };
visual = { cat = "visual"; }; in {
in { # AGGREGATORS (> 1 post/day)
# AGGREGATORS (> 1 post/day) "https://www.lesswrong.com/feed.xml" = rat // hourly;
"https://www.lesswrong.com/feed.xml" = rat // hourly; "http://www.econlib.org/index.xml" = pol // hourly;
"http://www.econlib.org/index.xml" = pol // hourly;
# AGGREGATORS (< 1 post/day) # AGGREGATORS (< 1 post/day)
"https://palladiummag.com/feed" = uncat // weekly; "https://palladiummag.com/feed" = uncat // weekly;
"https://profectusmag.com/feed" = uncat // weekly; "https://profectusmag.com/feed" = uncat // weekly;
"https://semiaccurate.com/feed" = tech // weekly; "https://semiaccurate.com/feed" = tech // weekly;
"https://linuxphoneapps.org/blog/atom.xml" = tech // infrequent; "https://linuxphoneapps.org/blog/atom.xml" = tech // infrequent;
"https://spectrum.ieee.org/rss" = tech // weekly; "https://spectrum.ieee.org/rss" = tech // weekly;
## No Moods, Ads or Cutesy Fucking Icons ## No Moods, Ads or Cutesy Fucking Icons
"https://www.rifters.com/crawl/?feed=rss2" = uncat // weekly; "https://www.rifters.com/crawl/?feed=rss2" = uncat // weekly;
# DEVELOPERS # DEVELOPERS
"https://mg.lol/blog/rss/" = infrequent // tech; "https://mg.lol/blog/rss/" = infrequent // tech;
## Ken Shirriff ## Ken Shirriff
"https://www.righto.com/feeds/posts/default" = tech // infrequent; "https://www.righto.com/feeds/posts/default" = tech // infrequent;
## Vitalik Buterin ## Vitalik Buterin
"https://vitalik.ca/feed.xml" = tech // infrequent; "https://vitalik.ca/feed.xml" = tech // infrequent;
## ian (Sanctuary) ## ian (Sanctuary)
"https://sagacioussuricata.com/feed.xml" = tech // infrequent; "https://sagacioussuricata.com/feed.xml" = tech // infrequent;
## Bunnie Juang ## Bunnie Juang
"https://www.bunniestudios.com/blog/?feed=rss2" = tech // infrequent; "https://www.bunniestudios.com/blog/?feed=rss2" = tech // infrequent;
"https://blog.danieljanus.pl/atom.xml" = tech // infrequent; "https://blog.danieljanus.pl/atom.xml" = tech // infrequent;
"https://ianthehenry.com/feed.xml" = tech // infrequent; "https://ianthehenry.com/feed.xml" = tech // infrequent;
"https://bitbashing.io/feed.xml" = tech // infrequent; "https://bitbashing.io/feed.xml" = tech // infrequent;
"https://idiomdrottning.org/feed.xml" = uncat // daily; "https://idiomdrottning.org/feed.xml" = uncat // daily;
# (TECH; POL) COMMENTATORS # (TECH; POL) COMMENTATORS
"http://benjaminrosshoffman.com/feed" = pol // weekly; "http://benjaminrosshoffman.com/feed" = pol // weekly;
## Ben Thompson ## Ben Thompson
"https://www.stratechery.com/rss" = pol // weekly; "https://www.stratechery.com/rss" = pol // weekly;
## Balaji ## Balaji
"https://balajis.com/rss" = pol // weekly; "https://balajis.com/rss" = pol // weekly;
"https://www.ben-evans.com/benedictevans/rss.xml" = pol // weekly; "https://www.ben-evans.com/benedictevans/rss.xml" = pol // weekly;
"https://www.lynalden.com/feed" = pol // infrequent; "https://www.lynalden.com/feed" = pol // infrequent;
"https://austinvernon.site/rss.xml" = tech // infrequent; "https://austinvernon.site/rss.xml" = tech // infrequent;
"https://oversharing.substack.com/feed" = pol // daily; "https://oversharing.substack.com/feed" = pol // daily;
"https://doomberg.substack.com/feed" = tech // weekly; "https://doomberg.substack.com/feed" = tech // weekly;
## David Rosenthal ## David Rosenthal
"https://blog.dshr.org/rss.xml" = pol // weekly; "https://blog.dshr.org/rss.xml" = pol // weekly;
## Matt Levine ## Matt Levine
"https://www.bloomberg.com/opinion/authors/ARbTQlRLRjE/matthew-s-levine.rss" = pol // weekly; "https://www.bloomberg.com/opinion/authors/ARbTQlRLRjE/matthew-s-levine.rss" = pol // weekly;
# RATIONALITY/PHILOSOPHY/ETC # RATIONALITY/PHILOSOPHY/ETC
"https://samkriss.substack.com/feed" = uncat // infrequent; # ... satire? phil? "https://samkriss.substack.com/feed" = uncat // infrequent; # ... satire? phil?
"https://unintendedconsequenc.es/feed" = rat // infrequent; "https://unintendedconsequenc.es/feed" = rat // infrequent;
"https://applieddivinitystudies.com/atom.xml" = rat // weekly; "https://applieddivinitystudies.com/atom.xml" = rat // weekly;
"https://slimemoldtimemold.com/feed.xml" = rat // weekly; "https://slimemoldtimemold.com/feed.xml" = rat // weekly;
"https://www.richardcarrier.info/feed" = rat // weekly; "https://www.richardcarrier.info/feed" = rat // weekly;
"https://www.gwern.net/feed.xml" = uncat // infrequent; "https://www.gwern.net/feed.xml" = uncat // infrequent;
## Jason Crawford ## Jason Crawford
"https://rootsofprogress.org/feed.xml" = rat // weekly; "https://rootsofprogress.org/feed.xml" = rat // weekly;
## Robin Hanson ## Robin Hanson
"https://www.overcomingbias.com/feed" = rat // daily; "https://www.overcomingbias.com/feed" = rat // daily;
## Scott Alexander ## Scott Alexander
"https://astralcodexten.substack.com/feed.xml" = rat // daily; "https://astralcodexten.substack.com/feed.xml" = rat // daily;
## Paul Christiano ## Paul Christiano
"https://sideways-view.com/feed" = rat // infrequent; "https://sideways-view.com/feed" = rat // infrequent;
## Sean Carroll ## Sean Carroll
"https://www.preposterousuniverse.com/rss" = rat // infrequent; "https://www.preposterousuniverse.com/rss" = rat // infrequent;
# COMICS # COMICS
"https://www.smbc-comics.com/comic/rss" = visual // daily; "https://www.smbc-comics.com/comic/rss" = visual // daily;
"https://xkcd.com/atom.xml" = visual // daily; "https://xkcd.com/atom.xml" = visual // daily;
"http://dilbert.com/feed" = visual // daily; "http://dilbert.com/feed" = visual // daily;
# ART # ART
"https://miniature-calendar.com/feed" = visual // daily; "https://miniature-calendar.com/feed" = visual // daily;
# CODE # CODE
"https://github.com/Kaiteki-Fedi/Kaiteki/commits/master.atom" = tech // infrequent; "https://github.com/Kaiteki-Fedi/Kaiteki/commits/master.atom" = tech // infrequent;
};
};
}; };
} }

View File

@@ -17,6 +17,7 @@ let
# extract `persist-files` from `extraPackages` # extract `persist-files` from `extraPackages`
persistfileslist = pkgspec: builtins.concatLists (builtins.map (e: if e ? "persist-files" then e.persist-files else []) pkgspec); persistfileslist = pkgspec: builtins.concatLists (builtins.map (e: if e ? "persist-files" then e.persist-files else []) pkgspec);
# TODO: dirlist and persistfileslist should be folded # TODO: dirlist and persistfileslist should be folded
feeds = import ./feeds.nix;
in in
{ {
options = { options = {
@@ -205,7 +206,7 @@ in
xdg.configFile."vlc/vlcrc".text = xdg.configFile."vlc/vlcrc".text =
let let
podcastUrls = lib.strings.concatStringsSep "|" sysconfig.sane.feeds.podcastUrls; podcastUrls = lib.strings.concatStringsSep "|" feeds.podcastUrls;
in '' in ''
[podcast] [podcast]
podcast-urls=${podcastUrls} podcast-urls=${podcastUrls}
@@ -219,7 +220,7 @@ in
let let
entries = builtins.toString (builtins.map entries = builtins.toString (builtins.map
(url: "\n " + ''<outline xmlUrl="${url}" type="rss"/>'') (url: "\n " + ''<outline xmlUrl="${url}" type="rss"/>'')
sysconfig.sane.feeds.podcastUrls feeds.podcastUrls
); );
in '' in ''
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
@@ -232,7 +233,7 @@ in
# news-flash RSS viewer # news-flash RSS viewer
xdg.configFile."newsflashFeeds.opml".text = xdg.configFile."newsflashFeeds.opml".text =
let let
entries = sysconfig.sane.feeds.rss; entries = feeds.rss;
urlsForCat = cat: builtins.filter (rss: entries."${rss}".cat == cat) (builtins.attrNames entries); urlsForCat = cat: builtins.filter (rss: entries."${rss}".cat == cat) (builtins.attrNames entries);
outlineEntriesFor = cat: builtins.map (rss: '' outlineEntriesFor = cat: builtins.map (rss: ''
<outline type="rss" xmlUrl="${rss}" /> <outline type="rss" xmlUrl="${rss}" />
@@ -266,7 +267,7 @@ in
# gnome feeds RSS viewer # gnome feeds RSS viewer
xdg.configFile."org.gabmus.gfeeds.json".text = builtins.toJSON { xdg.configFile."org.gabmus.gfeeds.json".text = builtins.toJSON {
feeds = builtins.mapAttrs (r: p: { tags = [ p.cat p.freq ]; }) sysconfig.sane.feeds.rss; feeds = builtins.mapAttrs (r: p: { tags = [ p.cat p.freq ]; }) feeds.rss;
dark_reader = false; dark_reader = false;
new_first = true; new_first = true;
# windowsize = { # windowsize = {