mirror of
https://github.com/nmasur/dotfiles
synced 2026-02-05 13:29:45 +00:00
74 lines
2.4 KiB
Nix
74 lines
2.4 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (config.nmasur.settings) username;
|
|
cfg = config.nmasur.presets.services.daily-summary;
|
|
|
|
process_urls = pkgs.writers.writePython3Bin "process-urls" {
|
|
libraries = [
|
|
pkgs.python3Packages.requests
|
|
pkgs.python3Packages.beautifulsoup4
|
|
];
|
|
} (builtins.readFile ./process-urls.py);
|
|
prompt = "Based on my browser usage for today from the markdown file located in /Users/${username}/Downloads/Sidebery/todays_urls.md, create or update a daily summary markdown file in the generated notes directory located in /Users/${username}/dev/personal/notes/generated/ with the filename format 'YYYY-MM-DD Daily Summary.md'. The resulting markdown file should use /Users/${username}/dev/personal/notes/templates/generated-summary.md as a format template, and it should summarize where I have spent my time today and highlight any notable links that I have visited. Please create markdown links to other relevant notes in /Users/${username}/dev/personal/notes/. If there is an existing markdown file for today, update it to include the newest information.";
|
|
in
|
|
|
|
{
|
|
|
|
options.nmasur.presets.services.daily-summary.enable = lib.mkEnableOption "Daily work summary";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
launchd.user.agents.daily-summary = {
|
|
# This replaces program and args entirely
|
|
script = ''
|
|
${process_urls}/bin/process-urls /Users/${username}/Downloads/Sidebery/
|
|
GEMINI_API_KEY=$(cat /Users/${username}/.config/gemini/.gemini_api_key) ${pkgs.gemini-cli}/bin/gemini --allowed-tools all --yolo --include-directories /Users/${username}/Downloads/Sidebery/ --include-directories /Users/${username}/dev/personal/notes/ "${prompt}"
|
|
'';
|
|
|
|
path = [
|
|
pkgs.bash
|
|
pkgs.coreutils
|
|
];
|
|
|
|
serviceConfig = {
|
|
Label = "com.example.daily-summary";
|
|
# Runs the script through /bin/sh automatically
|
|
# RunAtLoad = true;
|
|
StartCalendarInterval = [
|
|
{
|
|
Hour = 11;
|
|
Minute = 45;
|
|
}
|
|
{
|
|
Hour = 3;
|
|
Minute = 45;
|
|
}
|
|
{
|
|
Hour = 4;
|
|
Minute = 45;
|
|
}
|
|
{
|
|
Hour = 6;
|
|
Minute = 0;
|
|
}
|
|
{
|
|
Hour = 9;
|
|
Minute = 0;
|
|
}
|
|
{
|
|
Hour = 11;
|
|
Minute = 0;
|
|
}
|
|
];
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
}
|