all repos — nixfiles @ e39b35da505cb166b6108f0c18e8dd9d5f9a3273

System and user configuration, managed by nix and home-manager

darwin: enable lorri notifications

Alan Pearce
commit

e39b35da505cb166b6108f0c18e8dd9d5f9a3273

parent

c0d72e91a0a7e2ef2d530c283935b5e67f5e4b91

1 file changed, 33 insertions(+), 7 deletions(-)

changed files
M system/settings/darwin.nix → system/settings/darwin.nix
@@ -37,16 +37,42 @@ allowUnfree = true;
}; services.lorri.enable = true; - launchd.user.agents.lorri = { + launchd.user.agents.lorri-notify = { + path = with pkgs; [ + gnugrep + jq + lorri + terminal-notifier + ]; + script = + let + jqFile = '' + ( + (.Started? | values | ["starting", .nix_file]), + (.Completed? | values | ["complete", .nix_file]), + (.Failure? | values | ["failed", .nix_file]) + ) + | @tsv + ''; + in + '' + set -euo pipefail + lorri info --shell-file . | grep -q 'Lorri Daemon Status:.*running' + lorri internal stream-events --kind live \ + | jq --unbuffered -r '${jqFile}' \ + | while IFS=$'\t' read -r status nixFile icon; do + nixFile=$(dirname ''${nixFile#$HOME/}) + terminal-notifier -group "lorri-$nixFile-$status" -title "Lorri" \ + -subtitle "Build $status" -message "$nixFile" \ + -ignoreDnD + sh -c "sleep 1 && terminal-notifier -remove \"lorri-$nixFile-$status\"" + done + ''; serviceConfig = { - RunAtLoad = lib.mkForce false; - Sockets = { - daemon = { - SockPathName = "${(builtins.getEnv "HOME")}/Library/Caches/com.github.target.lorri.lorri.lorri/daemon.socket"; - }; - }; + RunAtLoad = true; }; }; + launchd.daemons.limit-maxfiles = { serviceConfig = { Label = "limit-maxfiles";