diff --git a/home/default.nix b/home/default.nix index f9742fd..0c4a63e 100644 --- a/home/default.nix +++ b/home/default.nix @@ -39,6 +39,7 @@ rec { VISUAL = emacsCommand; ORGDIR = "${config.home.homeDirectory}/Documents/org"; UBCDIR = "${ORGDIR}/ubc"; + MAILDIR = "${config.home.homeDirectory}/Maildir"; }; stateVersion = "22.11"; username = "willem"; @@ -47,6 +48,7 @@ rec { imports = [ ./accounts.nix ./darwin.nix + ./feeds.nix ./packages.nix ./programs.nix ]; diff --git a/home/feeds.nix b/home/feeds.nix new file mode 100644 index 0000000..92f2891 --- /dev/null +++ b/home/feeds.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: + +let + feeds = { + xkcd = "http://xkcd.com/atom.xml"; + dailywtf = "http://syndication.thedailywtf.com/TheDailyWtf"; + nixos = "https://weekly.nixos.org/feeds/all.rss.xml"; + rust = "https://blog.rust-lang.org/feed.xml"; + insiderust = "https://blog.rust-lang.org/inside-rust/feed.xml"; + kdb424 = "https://blog.kdb424.xyz/atom.xml"; + devto = "https://dev.to/feed/"; + }; + + config = { + html-mail = "True"; + date-header = "True"; + from = "rss2email@home.localhost"; + force-from = "False"; + use-publisher-email = "True"; + active = "true"; + to = "willem@home.localhost"; + email-protocol = "maildir"; + maildir-mailbox = "feeds"; + maildir-path = config.home.sessionVariables.MAILDIR; + }; + + mkFeedString = name: url: '' + [feed.${name}] + url = ${url} + ''; + + configStrings = lib.mapAttrsToList (name: value: "${name} = ${value}\n") config; + + feedStrings = lib.mapAttrsToList mkFeedString feeds; + + configArray = [ "[DEFAULT]\n" ] ++ configStrings ++ feedStrings; + + configString = lib.concatStrings configArray; +in +{ + home.packages = [ pkgs.rss2email ]; + + home.file.".config/rss2email.cfg".text = configString; +}