parent
79c16b9a90
commit
90bf989002
5 changed files with 79 additions and 12 deletions
|
|
@ -14,10 +14,32 @@ in
|
|||
enable = mkEnableOption "the Newsboat feed reader";
|
||||
|
||||
urls = mkOption {
|
||||
type = types.listOf types.attrs;
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
example = "http://example.com";
|
||||
description = "Feed URL.";
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = ["foo" "bar"];
|
||||
description = "Feed tags.";
|
||||
};
|
||||
|
||||
title = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "ORF News";
|
||||
description = "Feed title.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
example = [{url = "http://example.com"; tags = ["foo" "bar"];}];
|
||||
description = "List of urls and tokens.";
|
||||
description = "List of news feeds.";
|
||||
};
|
||||
|
||||
maxItems = mkOption {
|
||||
|
|
@ -71,19 +93,18 @@ in
|
|||
home.packages = [ pkgs.newsboat ];
|
||||
home.file.".newsboat/urls".text =
|
||||
let
|
||||
urls = builtins.concatStringsSep "\n" (
|
||||
map (u: builtins.concatStringsSep " " ([u.url] ++ (map wrapQuote u.tags)))
|
||||
cfg.urls);
|
||||
queries = builtins.concatStringsSep "\n" (
|
||||
mapAttrsToList (n: v: "\"query:${n}:${escape ["\""] v}\"") cfg.queries);
|
||||
mkUrlEntry = u: concatStringsSep " " (
|
||||
[u.url]
|
||||
++ map wrapQuote u.tags
|
||||
++ optional (u.title != null) (wrapQuote "~${u.title}")
|
||||
);
|
||||
urls = map mkUrlEntry cfg.urls;
|
||||
|
||||
mkQueryEntry = n: v: "\"query:${n}:${escape ["\""] v}\"";
|
||||
queries = mapAttrsToList mkQueryEntry cfg.queries;
|
||||
in
|
||||
concatStringsSep "\n" (urls ++ queries) + "\n";
|
||||
|
||||
''
|
||||
${urls}
|
||||
|
||||
${queries}
|
||||
'';
|
||||
home.file.".newsboat/config".text = ''
|
||||
max-items ${toString cfg.maxItems}
|
||||
browser ${cfg.browser}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue