diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-06-29 23:03:34 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-06-29 23:03:36 +0530 |
| commit | c8406fc2fa09e09ea4d9a010e5aed5d4f54104fd (patch) | |
| tree | 317ae1961a78b66270d862795e41ea7364f53d83 | |
| parent | 1ea3c72321a83143591bd4e9989da94798c2d71b (diff) | |
| download | homeserver-nixos-config-c8406fc2fa09e09ea4d9a010e5aed5d4f54104fd.tar.gz homeserver-nixos-config-c8406fc2fa09e09ea4d9a010e5aed5d4f54104fd.zip | |
Add yarr (my fork) rss reader + disable send
| -rwxr-xr-x | build.sh | 2 | ||||
| -rw-r--r-- | flake.lock | 57 | ||||
| -rw-r--r-- | flake.nix | 7 | ||||
| -rw-r--r-- | modules/config.nix | 1 | ||||
| -rw-r--r-- | modules/dashboard/links.nix | 17 | ||||
| -rw-r--r-- | modules/network/default.nix | 3 | ||||
| -rw-r--r-- | modules/rss/default.nix | 31 | ||||
| -rw-r--r-- | modules/rss/feeds.nix | 89 | ||||
| -rw-r--r-- | modules/rss/utils.nix | 39 | ||||
| -rw-r--r-- | modules/storage/send.nix | 2 | ||||
| -rw-r--r-- | settings.nix | 1 |
11 files changed, 239 insertions, 10 deletions
@@ -66,7 +66,7 @@ case "$cmd" in fs) run_ssh lf ;; test-dash) gen_test_dash ;; open-test-dash) open_test_dash ;; - dash) brave "http://$HOME_HOST" ;; + dash) brave "http://home.local" ;; copy_in) copy_in "$@" ;; copy_out) copy_out "$@" ;; _) chaincmds "$@" ;; @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1749832440, @@ -31,10 +49,47 @@ "type": "github" } }, + "phenax-yayarr": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751216786, + "narHash": "sha256-b9JwRbKDDBCW8bQ0DrgpPMFYj2XTk21q95scMwlSyHQ=", + "owner": "phenax", + "repo": "yayarr", + "rev": "3391a0ae601c23801b707f7ef925ad7eb850a79d", + "type": "github" + }, + "original": { + "owner": "phenax", + "repo": "yayarr", + "type": "github" + } + }, "root": { "inputs": { "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "phenax-yayarr": "phenax-yayarr" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, @@ -2,14 +2,19 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware"; + phenax-yayarr = { + url = "github:phenax/yayarr"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, nixos-hardware, ... }: { + outputs = { self, nixpkgs, nixos-hardware, phenax-yayarr, ... }: { nixosConfigurations.bacchus = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { settings = import ./settings.nix { inherit (nixpkgs) lib; }; inherit nixos-hardware; + phenax-yayarr = phenax-yayarr.packages.x86_64-linux.default; }; modules = [ ./modules/config.nix ]; }; 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; diff --git a/settings.nix b/settings.nix index ed2f212..cf110cc 100644 --- a/settings.nix +++ b/settings.nix @@ -20,6 +20,7 @@ in lib.recursiveUpdate privateSettings rec { prometheusNodeExporter = 9002; send = 1443; immich = 3144; + yarr = 7070; }; exposeTransmissionRPC = false; }; |
