2023-07-23 21:00:43 +00:00
|
|
|
{ config, lib, pkgs, sane-lib, ... }:
|
2023-06-19 09:21:30 +00:00
|
|
|
|
2023-06-20 19:58:02 +00:00
|
|
|
let
|
|
|
|
feeds = sane-lib.feeds;
|
|
|
|
allFeeds = config.sane.feeds;
|
|
|
|
wantedFeeds = feeds.filterByFormat [ "image" "text" ] allFeeds;
|
|
|
|
koreaderRssEntries = builtins.map (feed:
|
|
|
|
# format:
|
|
|
|
# { "<rss/atom url>", limit = <int>, download_full_article=<bool>, include_images=<bool>, enable_filter=<bool>, filter_element = "<css selector>"},
|
|
|
|
# limit = 0 => download and keep *all* articles
|
|
|
|
# download_full_article = true => populate feed by downloading the webpage -- not just what's encoded in the RSS <article> tags
|
|
|
|
# - use this for articles where the RSS only encodes content previews
|
2023-07-22 08:55:05 +00:00
|
|
|
# - in practice, most articles don't work with download_full_article = false
|
2023-06-20 19:58:02 +00:00
|
|
|
# enable_filter = true => only render content that matches the filter_element css selector.
|
|
|
|
let fields = [
|
|
|
|
(lib.escapeShellArg feed.url)
|
|
|
|
"limit = 5"
|
2023-07-22 08:55:05 +00:00
|
|
|
"download_full_article = true"
|
2023-06-20 19:58:02 +00:00
|
|
|
"include_images = true"
|
|
|
|
"enable_filter = false"
|
|
|
|
"filter_element = \"\""
|
|
|
|
]; in "{ ${lib.concatStringsSep ", " fields } }"
|
|
|
|
) wantedFeeds;
|
|
|
|
in {
|
2023-06-19 09:21:30 +00:00
|
|
|
sane.programs.koreader = {
|
2023-07-23 21:00:43 +00:00
|
|
|
package = pkgs.koreader-from-src;
|
2023-06-19 09:21:30 +00:00
|
|
|
# koreader applies these lua "patches" at boot:
|
|
|
|
# - <https://github.com/koreader/koreader/wiki/User-patches>
|
|
|
|
# - TODO: upstream this patch to koreader
|
|
|
|
# fs.".config/koreader/patches".symlink.target = "${./.}";
|
|
|
|
fs.".config/koreader/patches/2-colin-NetworkManager-isConnected.lua".symlink.target = "${./2-colin-NetworkManager-isConnected.lua}";
|
|
|
|
|
2023-06-20 19:58:02 +00:00
|
|
|
# koreader news plugin, enabled by default. file format described here:
|
|
|
|
# - <repo:koreader/koreader:plugins/newsdownloader.koplugin/feed_config.lua>
|
|
|
|
fs.".config/koreader/news/feed_config.lua".symlink.text = ''
|
|
|
|
return {--do NOT change this line
|
|
|
|
${lib.concatStringsSep ",\n " koreaderRssEntries}
|
|
|
|
}--do NOT change this line
|
|
|
|
'';
|
2023-10-28 01:49:16 +00:00
|
|
|
# easier to navigate via filebrowser than finding the news menu entry
|
|
|
|
fs."Books/rss-koreader".symlink.target = "../.config/koreader/news";
|
2023-06-20 19:58:02 +00:00
|
|
|
|
2023-06-19 09:21:30 +00:00
|
|
|
# koreader on aarch64 errors if there's no fonts directory (sandboxing thing, i guess)
|
|
|
|
fs.".local/share/fonts".dir = {};
|
|
|
|
|
|
|
|
# history, cache, dictionaries...
|
|
|
|
# could be more explicit if i symlinked the history.lua file to somewhere it can persist better.
|
|
|
|
persist.plaintext = [ ".config/koreader" ];
|
|
|
|
};
|
|
|
|
}
|