summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock23
-rw-r--r--flake.nix4
-rw-r--r--home/home.nix20
-rw-r--r--home/packages.nix5
-rwxr-xr-xhome/scripts/sync.scm28
5 files changed, 70 insertions, 10 deletions
diff --git a/flake.lock b/flake.lock
index 27b1118..17fc7a7 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,17 @@
{
"nodes": {
+ "almanac": {
+ "flake": false,
+ "locked": {
+ "narHash": "sha256-n5KQnYlL8I5RDp+Zrfv+a3hQjVy7V6Y62Njo7KfuwVg=",
+ "path": "/home/stuebinm/clones/almanac",
+ "type": "path"
+ },
+ "original": {
+ "path": "/home/stuebinm/clones/almanac",
+ "type": "path"
+ }
+ },
"blog": {
"flake": false,
"locked": {
@@ -37,12 +49,12 @@
"feeds": {
"flake": false,
"locked": {
- "narHash": "sha256-OE743zmJzUgPZyQhzlRrqyd5fub/W8eFrCXzY8++EiQ=",
- "path": "/home/stuebinm/newsboat-feeds-private.nix",
+ "narHash": "sha256-kUVP8HdLOhrYFjf5q+btB8nftU7ATu+aWufQ4h+E0wU=",
+ "path": "/home/stuebinm/nonpublic.nix",
"type": "path"
},
"original": {
- "path": "/home/stuebinm/newsboat-feeds-private.nix",
+ "path": "/home/stuebinm/nonpublic.nix",
"type": "path"
}
},
@@ -139,9 +151,9 @@
"flake": false,
"locked": {
"lastModified": 1631386631,
- "narHash": "sha256-VnCf3O5XnGcRttEzjrv4i9tOXAcaXImh5mo44pNnzwY=",
+ "narHash": "sha256-qwLsBbYhoPafygYRCOqs+hZR08t+soznsCixyoNfiHk=",
"ref": "master",
- "rev": "d6ee1209ce08103dd2b8294c9399d628d1394f9e",
+ "rev": "2c9c4425903fdd168ba6cfbc3e9e5df35a111682",
"revCount": 20,
"type": "git",
"url": "https://stuebinm.eu/git/playground"
@@ -153,6 +165,7 @@
},
"root": {
"inputs": {
+ "almanac": "almanac",
"blog": "blog",
"deploy-rs": "deploy-rs",
"feeds": "feeds",
diff --git a/flake.nix b/flake.nix
index b8f36ab..017b7b9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,7 +26,9 @@
naersk.inputs.nixpkgs.follows = "nixpkgs";
sfz.url = "github:weihanglo/sfz";
sfz.flake = false;
- feeds.url = "path:/home/stuebinm/newsboat-feeds-private.nix";
+ almanac.url = "path:/home/stuebinm/clones/almanac";
+ almanac.flake = false;
+ feeds.url = "path:/home/stuebinm/nonpublic.nix";
feeds.flake = false;
deploy-rs.url = "github:serokell/deploy-rs";
diff --git a/home/home.nix b/home/home.nix
index f2a0f7e..57aa9b2 100644
--- a/home/home.nix
+++ b/home/home.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, inputs, ... }:
+{ config, lib, pkgs, inputs, ... }:
{
# Let Home Manager install and manage itself.
@@ -86,6 +86,7 @@
ll = "exa -lh --grid --icons";
llt = "exa -lh --tree --icons";
lt = "exa --tree --icons";
+ agenda = "almanac month ~/.cache/feedsync/*";
};
functions = {
fish_greeting = {
@@ -94,9 +95,24 @@
};
};
+ systemd.user.services.syncical = let
+ feeds = (import inputs.feeds).ical; in {
+ Unit.Description = "syncs ical feeds for almanac agenda";
+ Service.ExecStart = "${./scripts/sync.scm} ${lib.fold (a: b: a + " " + b) "" feeds}";
+ };
+
+ systemd.user.timers.syncical = {
+ Unit.Description = "automatically fetch new calendars";
+ Timer = {
+ OnCalendar = "hourly";
+ Unit = "syncical.service";
+ };
+ Install.WantedBy = [ "timers.target" ];
+ };
+
programs.newsboat = {
enable = true;
- urls = (import ./newsboat-public.nix) ++ (import inputs.feeds);
+ urls = (import ./newsboat-public.nix) ++ (import inputs.feeds).rss;
browser = pkgs.lynx.outPath + "/bin/lynx";
reloadThreads = 100;
queries = {
diff --git a/home/packages.nix b/home/packages.nix
index 6182ad3..e408c21 100644
--- a/home/packages.nix
+++ b/home/packages.nix
@@ -4,6 +4,7 @@ let
naersk = pkgs.callPackage inputs.naersk {};
extras = {
sfz = naersk.buildPackage inputs.sfz;
+ almanac = naersk.buildPackage inputs.almanac;
leylines = pkgs.callPackage "${(pkgs.fetchgit {
url = "https://gitlab.infra4future.de/stuebinm/leylines";
sha256 = "sha256-zhUYAqa8qEa+2VvLU2/BRQ/0RV95/3UTU/nvybopZ7A=";
@@ -44,7 +45,7 @@ in
tree dnsutils inetutils pijul bat age libsecret gping bottom dogdns
cifs-utils jekyll fzf ripgrep fd bandwhich exa dive
ripgrep python39Packages.isort shellcheck graphviz
- poppler unzip acpi extras.sfz viu extras.leylines
+ poppler unzip acpi extras.sfz extras.almanac viu extras.leylines
youtube-dl
# git
gitAndTools.gitAnnex git-bug git-appraise
@@ -57,7 +58,7 @@ in
haskellPackages.hoogle haskellPackages.stylish-haskell
# other functional things
racket dhall lean dune_2 ocamlPackages.utop ocamlPackages.ocp-indent
- ocamlPackages.merlin ocaml
+ ocamlPackages.merlin ocaml gauche
# html, js & co
jq html-tidy nodePackages.stylelint nodePackages.js-beautify zola
# purescript
diff --git a/home/scripts/sync.scm b/home/scripts/sync.scm
new file mode 100755
index 0000000..a51b557
--- /dev/null
+++ b/home/scripts/sync.scm
@@ -0,0 +1,28 @@
+#!/usr/bin/env gosh
+
+;; download the given files to ~/.cache/feedsync under hashed filenames
+;; if the versions there are older than two hours
+
+(use util.match)
+(use gauche.process)
+
+
+(define targets
+ (cdr (command-line)))
+
+(define cachedir
+ (string-append (sys-getenv "HOME") "/.cache/feedsync"))
+
+(do-process `("mkdir" "-p" ,cachedir))
+
+(map (lambda (target)
+ (let ([cachefile (format "~a/~a.ics" cachedir (portable-hash target 0))])
+ (cond
+ [(not (file-exists? cachefile))
+ (do-process `("curl" ,target "-o" ,cachefile))]
+ [(< 7200 (- (sys-time) (sys-stat->mtime (sys-stat cachefile))))
+ (print (format "fetching ~a" target))
+ (do-process `("curl" ,target "-o" ,cachefile))]
+ [else
+ (display "time limit not yet exceeded")])))
+ targets)