From 04de6d0335187224d73c45b770a270057effafea Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 6 Jun 2025 14:25:40 +0530 Subject: Add orgmode notifier timer+service --- config/nvim | 2 +- modules/calendar.home/default.nix | 12 +++++++-- modules/calendar.home/orgmode-notifier.module.nix | 33 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 modules/calendar.home/orgmode-notifier.module.nix diff --git a/config/nvim b/config/nvim index 18a7b83..3175f83 160000 --- a/config/nvim +++ b/config/nvim @@ -1 +1 @@ -Subproject commit 18a7b8312709b60633498914e183c878d9cbfe40 +Subproject commit 3175f83b3c12ed36214798fe479e18d3f10f928b diff --git a/modules/calendar.home/default.nix b/modules/calendar.home/default.nix index 997e2eb..06ea982 100644 --- a/modules/calendar.home/default.nix +++ b/modules/calendar.home/default.nix @@ -3,13 +3,16 @@ let private = import ./private.nix; in { - imports = [ ./ical2org.module.nix ]; + imports = [ + ./ical2org.module.nix + ./orgmode-notifier.module.nix + ]; services.ical2org = { enable = true; icalLink = private.icalLink; outputPath = "${config.home.homeDirectory}/nixos/extras/notes/calendar-sync.autogen.org"; - syncFrequency = "*:0/10"; + syncFrequency = "*:0/10"; # Every 10 minutes settings = { filetags = "calendar"; email = private.email; @@ -20,4 +23,9 @@ in future = 30; # days }; }; + + services.orgmode-notifier = { + enable = true; + pollFrequency = "*:0/1"; # Every minute + }; } diff --git a/modules/calendar.home/orgmode-notifier.module.nix b/modules/calendar.home/orgmode-notifier.module.nix new file mode 100644 index 0000000..b33c2fe --- /dev/null +++ b/modules/calendar.home/orgmode-notifier.module.nix @@ -0,0 +1,33 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.services.orgmode-notifier; + + service-unit = { + Service = { + Type = "oneshot"; + ExecStart = "${config.xdg.configHome}/nvim/orgmode_notifier.sh"; + WorkingDirectory = config.home.homeDirectory; + Environment = "PATH=${pkgs.neovim}/bin:${pkgs.libnotify}/bin:/usr/bin:/bin"; + }; + }; + + timer-unit = { + Timer = { + OnCalendar = cfg.pollFrequency; + RandomizedDelaySec = 30; + }; + Install.WantedBy = [ "timers.target" ]; + }; +in { + options.services.orgmode-notifier = { + enable = mkEnableOption "orgmode notifier"; + pollFrequency = mkOption { type = types.str; default = "*:0/1"; }; + }; + + config = mkIf cfg.enable { + programs.lieer.enable = true; + systemd.user.services.orgmode-notifier = service-unit; + systemd.user.timers.orgmode-notifier = timer-unit; + }; +} -- cgit v1.3.1