aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-06-29 23:03:34 +0530
committerAkshay Nair <phenax5@gmail.com>2025-06-29 23:03:36 +0530
commitc8406fc2fa09e09ea4d9a010e5aed5d4f54104fd (patch)
tree317ae1961a78b66270d862795e41ea7364f53d83 /modules
parent1ea3c72321a83143591bd4e9989da94798c2d71b (diff)
downloadhomeserver-nixos-config-c8406fc2fa09e09ea4d9a010e5aed5d4f54104fd.tar.gz
homeserver-nixos-config-c8406fc2fa09e09ea4d9a010e5aed5d4f54104fd.zip
Add yarr (my fork) rss reader + disable send
Diffstat (limited to 'modules')
-rw-r--r--modules/config.nix1
-rw-r--r--modules/dashboard/links.nix17
-rw-r--r--modules/network/default.nix3
-rw-r--r--modules/rss/default.nix31
-rw-r--r--modules/rss/feeds.nix89
-rw-r--r--modules/rss/utils.nix39
-rw-r--r--modules/storage/send.nix2
7 files changed, 175 insertions, 7 deletions
diff --git a/modules/config.nix b/modules/config.nix
index a4b6c79..e314a7d 100644
--- a/modules/config.nix
+++ b/modules/config.nix
@@ -9,6 +9,7 @@
./storage
./notifications
./monitoring
+ ./rss
./packages.nix
];
diff --git a/modules/dashboard/links.nix b/modules/dashboard/links.nix
index 4ac0337..d2410f3 100644
--- a/modules/dashboard/links.nix
+++ b/modules/dashboard/links.nix
@@ -66,11 +66,18 @@ in [
altUrl = "http://${host}:${toString ports.grafana}";
color = "#f05a28";
}
+ # {
+ # title = "Send";
+ # key = "f";
+ # url = "http://send.local";
+ # altUrl = "http://${host}:${toString ports.send}";
+ # color = "#0a84ff";
+ # }
{
- title = "Send";
- key = "f";
- url = "http://send.local";
- altUrl = "http://${host}:${toString ports.send}";
- color = "#0a84ff";
+ title = "News RSS";
+ key = "w";
+ url = "http://news.local";
+ altUrl = "http://${host}:${toString ports.yarr}";
+ color = "#475569";
}
]
diff --git a/modules/network/default.nix b/modules/network/default.nix
index 93f41a8..fdd99ab 100644
--- a/modules/network/default.nix
+++ b/modules/network/default.nix
@@ -29,8 +29,9 @@ in
"lidarr.local" = { inherit host; port = ports.lidarr; };
"ntfy.local" = { inherit host; port = ports.ntfy; };
"grafana.local" = { inherit host; port = ports.grafana; extraNginxOptions.recommendedProxySettings = true; };
- "send.local" = { inherit host; port = ports.send; };
+ # "send.local" = { inherit host; port = ports.send; };
"photos.local" = { inherit host; port = ports.immich; };
+ "news.local" = { inherit host; port = ports.yarr; };
};
};
diff --git a/modules/rss/default.nix b/modules/rss/default.nix
new file mode 100644
index 0000000..9473c30
--- /dev/null
+++ b/modules/rss/default.nix
@@ -0,0 +1,31 @@
+{ pkgs, settings, phenax-yayarr, ... }@attrs:
+let
+ ports = settings.network.ports;
+ yarr = settings.yarr;
+ utils = import ./utils.nix attrs;
+
+ yarrSetupScript = utils.createYarrSetupScript {
+ inherit (yarr) username api_key;
+ api_url = "http://localhost:${toString ports.yarr}";
+ feeds = import ./feeds.nix;
+ settings = {
+ theme_font = "monospace";
+ theme_name = "night";
+ theme_size = 1.1;
+ refresh_rate = 30;
+ };
+ };
+in
+{
+ services.yarr = {
+ enable = true;
+ port = ports.yarr;
+ address = "0.0.0.0";
+ package = phenax-yayarr;
+ authFilePath = pkgs.writeText "yarr-auth" ''${yarr.username}:${yarr.password}'';
+ };
+
+ networking.firewall.allowedTCPPorts = [ ports.yarr ];
+
+ environment.systemPackages = [ yarrSetupScript ];
+}
diff --git a/modules/rss/feeds.nix b/modules/rss/feeds.nix
new file mode 100644
index 0000000..f3e0978
--- /dev/null
+++ b/modules/rss/feeds.nix
@@ -0,0 +1,89 @@
+let
+ youtube = id: title: {
+ title = "${title}";
+ url = "https://www.youtube.com/feeds/videos.xml?channel_id=${id}";
+ };
+ reddit = subreddit: {
+ title = "r/${subreddit}";
+ url = "https://www.reddit.com/r/${subreddit}/top/.rss?t=month";
+ };
+in
+{
+ title = "Feed reader";
+
+ groups = {
+ "Blogs" = [
+ { url = "https://rubyonrails.org/feed.xml"; title = "Rails blog"; }
+ { url = "https://lexi-lambda.github.io/feeds/all.rss.xml"; title = "Lexi Lambda"; }
+ { url = "https://overreacted.io/rss.xml"; title = "Dan Abramov"; }
+ { url = "https://tkdodo.eu/blog/rss.xml"; title = "Tkdodo"; }
+ { url = "https://kentcdodds.com/blog/rss.xml"; title = "Kent C Dodds"; }
+ { url = "https://world.hey.com/dhh/feed.atom"; title = "DHH horseshit"; }
+ { url = "https://developer.chrome.com/blog/feed.xml"; title = "Chrome"; }
+ { url = "https://programmingisterrible.com/rss"; title = "Programming is terrible"; }
+ { url = "https://reacttraining.com/rss.xml"; title = "React Training"; }
+ { url = "https://www.developerway.com/rss.xml"; title = "Developer way"; }
+ ];
+
+ "Reddit" = [
+ (reddit "dumbphones")
+ (reddit "selfhosted")
+ (reddit "homeserver")
+ (reddit "crafting")
+ (reddit "coolguides")
+ (reddit "whittling")
+ (reddit "psychologymemes")
+ (reddit "petthedamndog")
+ (reddit "animalsbeingderps")
+ (reddit "lifeprotips")
+ (reddit "linuxmemes")
+ ];
+
+ "Dev news" = [
+ { url = "https://cprss.s3.amazonaws.com/javascriptweekly.com.xml"; title = "JS weekly"; }
+ { url = "https://cprss.s3.amazonaws.com/react.statuscode.com.xml"; title = "React status"; }
+ { url = "https://www.totaltypescript.com/rss.xml"; title = "Total typescript"; }
+ { url = "https://dev.to/feed/tag/haskell"; title = "Haskell - dev.to"; }
+ { url = "https://devblogs.microsoft.com/typescript/feed/"; title = "TS announcements"; }
+ # { url = "https://news.ycombinator.com/rss"; title = "Hacker news"; }
+ { url = "https://mshibanami.github.io/GitHubTrendingRSS/daily/all.xml"; title = "Github trending"; }
+ { url = "https://blog.haskell.org/atom.xml"; title = "Haskell news"; }
+ ];
+
+ "Linux" = [
+ { url = "https://nixos.org/blog/announcements-rss.xml"; title = "Nixos announcements"; }
+ { url = "https://www.cyberciti.com/feed/"; title = "Cyberciti news"; }
+ { url = "https://itsfoss.com/rss/"; title = "Its FOSS"; }
+ ];
+
+ "Neovim" = [
+ { url = "https://dotfyle.com/this-week-in-neovim/rss.xml"; title = "This week in neovim"; }
+ { url = "https://dotfyle.com/neovim/plugins/rss.xml"; title = "New plugins"; }
+ { url = "https://vimtricks.com/feed/"; title = "Vimtricks"; }
+ (reddit "neovim")
+ ];
+
+ "Youtube" = [
+ (youtube "UCJswRv22oiUgmT1FuFeUekw" "IamMoBo")
+ (youtube "UCSb_Sui6FBxVS4_ROsrU_Iw" "NaturalHabitatShorts")
+ (youtube "UCR1D15p_vdP3HkrH8wgjQRw" "InternetHistorian")
+ (youtube "UC8Q7XEy86Q7T-3kNpNjYgwA" "Incognito Mode")
+ (youtube "UCW7AGm8JSBEEew61dJIgl_A" "Tom Cardy")
+ (youtube "UCh9IfI45mmk59eDvSWtuuhQ" "Ryan George")
+ (youtube "UCM15YNy8g-CaJ15YZCbq0Iw" "North of the border")
+ (youtube "UC-lHJZR3Gqxm24_Vd_AJ5Yw" "Pewdiepie")
+ (youtube "UCUMwY9iS8oMyWDYIe6_RmoA" "No boilerplate")
+ (youtube "UCo71RUe6DX4w-Vd47rFLXPg" "TypeCraft")
+ (youtube "UCWQaM7SpSECp9FELz-cHzuQ" "Dreams of code")
+ (youtube "UCjr2bPAyPV7t35MvcgT3W8Q" "The Hated One")
+ (youtube "UCimiUgDLbi6P17BdaCZpVbg" "exurb1a")
+ (youtube "UCr3cBLTYmIK9kY0F_OdFWFQ" "Casually Explained")
+ (youtube "UCYO_jab_esuFRV4b17AJtAw" "3Blue 1Brown")
+ (youtube "UCHnyfMqiRRG1u-2MsSQLbXA" "Veritasium")
+ ];
+
+ "Others" = [
+ { url = "https://xkcd.com/rss.xml"; title = "xkcd"; }
+ ];
+ };
+}
diff --git a/modules/rss/utils.nix b/modules/rss/utils.nix
new file mode 100644
index 0000000..63d09df
--- /dev/null
+++ b/modules/rss/utils.nix
@@ -0,0 +1,39 @@
+{ pkgs, lib, ... }:
+with lib;
+let
+ outlineItem = feed:
+ ''<outline title="${feed.title}" text="${feed.title}" xmlUrl="${feed.url}" />'';
+
+ outlineGroup = group: items:
+ ''<outline title="${group}" text="${group}">
+ ${concatStringsSep "\n" (map outlineItem items)}
+ </outline>'';
+
+ toOpml = cfg: ''
+<?xml version="1.0" encoding="UTF-8"?>
+<opml version="1.1">
+ <head>
+ <title>
+ ${cfg.title}
+ </title>
+ </head>
+ <body>
+ ${concatStringsSep "\n" (mapAttrsToList outlineGroup cfg.groups)}
+ </body>
+</opml>'';
+
+ createYarrSetupScript = { username, api_key, api_url, feeds, settings }:
+ let
+ api = method: path: args:
+ ''curl -i -X${method} '${api_url}${path}' --cookie 'auth=${username}:${api_key}' ${args}'';
+ opmlFile = pkgs.writeText "rss.opml" (toOpml feeds);
+ in
+ pkgs.writeShellScriptBin "yarr-setup-script" ''
+ #!/usr/bin/env sh
+
+ ${api "POST" "/opml/import" "-F 'opml=@${opmlFile}' -F 'replace=true'"} && echo "Imported feeds";
+ ${api "PUT" "/api/settings" "--data '${builtins.toJSON settings}'"} && echo "Applied settings";
+ '';
+in {
+ inherit toOpml createYarrSetupScript;
+}
diff --git a/modules/storage/send.nix b/modules/storage/send.nix
index b6b8b5c..813b2a4 100644
--- a/modules/storage/send.nix
+++ b/modules/storage/send.nix
@@ -1,7 +1,7 @@
{ settings, ... }:
{
services.send = {
- enable = true;
+ enable = false;
port = settings.network.ports.send;
host = "0.0.0.0";
openFirewall = true;