diff options
Diffstat (limited to 'home-manager/modules/programs/newsboat.nix')
-rw-r--r-- | home-manager/modules/programs/newsboat.nix | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/home-manager/modules/programs/newsboat.nix b/home-manager/modules/programs/newsboat.nix index 19fec642d21..6b59ed713d8 100644 --- a/home-manager/modules/programs/newsboat.nix +++ b/home-manager/modules/programs/newsboat.nix @@ -4,11 +4,9 @@ with lib; let cfg = config.programs.newsboat; - wrapQuote = x: "\"${x}\""; + wrapQuote = x: ''"${x}"''; -in - -{ +in { options = { programs.newsboat = { enable = mkEnableOption "the Newsboat feed reader"; @@ -24,8 +22,8 @@ in tags = mkOption { type = types.listOf types.str; - default = []; - example = ["foo" "bar"]; + default = [ ]; + example = [ "foo" "bar" ]; description = "Feed tags."; }; @@ -37,8 +35,11 @@ in }; }; }); - default = []; - example = [{url = "http://example.com"; tags = ["foo" "bar"];}]; + default = [ ]; + example = [{ + url = "http://example.com"; + tags = [ "foo" "bar" ]; + }]; description = "List of news feeds."; }; @@ -57,7 +58,9 @@ in autoReload = mkOption { type = types.bool; default = false; - description = "Whether to enable automatic reloading while newsboat is running."; + description = '' + Whether to enable automatic reloading while newsboat is running. + ''; }; reloadTime = mkOption { @@ -74,43 +77,40 @@ in queries = mkOption { type = types.attrsOf types.str; - default = {}; - example = { - "foo" = "rssurl =~ \"example.com\""; - }; + default = { }; + example = { "foo" = ''rssurl =~ "example.com"''; }; description = "A list of queries to use."; }; extraConfig = mkOption { type = types.lines; default = ""; - description = "Extra configuration values that will be appended to the end."; + description = '' + Extra configuration values that will be appended to the end. + ''; }; }; }; config = mkIf cfg.enable { home.packages = [ pkgs.newsboat ]; - home.file.".newsboat/urls".text = - let - 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"; + home.file.".newsboat/urls".text = let + 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"; home.file.".newsboat/config".text = '' max-items ${toString cfg.maxItems} browser ${cfg.browser} reload-threads ${toString cfg.reloadThreads} auto-reload ${if cfg.autoReload then "yes" else "no"} - ${optionalString (cfg.reloadTime != null) (toString "reload-time ${toString cfg.reloadTime}")} + ${optionalString (cfg.reloadTime != null) + (toString "reload-time ${toString cfg.reloadTime}")} prepopulate-query-feeds yes ${cfg.extraConfig} |