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,12 +1,6 @@
{ lib, ... }:
with lib;
{ {
options = {
# TODO: fold this into RSS, with an `audio` category # TODO: fold this into RSS, with an `audio` category
sane.feeds.podcastUrls = mkOption { podcastUrls = [
type = types.listOf types.str;
default = [
"https://lexfridman.com/feed/podcast/" "https://lexfridman.com/feed/podcast/"
## Astral Codex Ten ## Astral Codex Ten
"http://feeds.libsyn.com/108018/rss" "http://feeds.libsyn.com/108018/rss"
@@ -37,11 +31,9 @@ with lib;
## 60 minutes (NB: this features more than *just* audio?) ## 60 minutes (NB: this features more than *just* audio?)
"https://www.cbsnews.com/latest/rss/60-minutes" "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"; };
@@ -126,6 +118,4 @@ with lib;
# 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 = {