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 = [
./feeds.nix
./home-manager.nix
./home-packages.nix
./system-packages.nix

View File

@@ -1,12 +1,6 @@
{ lib, ... }:
with lib;
{
options = {
# TODO: fold this into RSS, with an `audio` category
sane.feeds.podcastUrls = mkOption {
type = types.listOf types.str;
default = [
podcastUrls = [
"https://lexfridman.com/feed/podcast/"
## Astral Codex Ten
"http://feeds.libsyn.com/108018/rss"
@@ -37,11 +31,9 @@ with lib;
## 60 minutes (NB: this features more than *just* audio?)
"https://www.cbsnews.com/latest/rss/60-minutes"
];
};
sane.feeds.rss = mkOption {
type = types.attrs;
default = let
rss =
let
hourly = { freq = "hourly"; };
daily = { freq = "daily"; };
weekly = { freq = "weekly"; };
@@ -126,6 +118,4 @@ with lib;
# CODE
"https://github.com/Kaiteki-Fedi/Kaiteki/commits/master.atom" = tech // infrequent;
};
};
};
}

View File

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