-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add automatic brew upgrader service #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||
| { pkgs, ... }: | ||||||||||
| { | ||||||||||
| launchd.agents.brew-upgrader = pkgs.lib.mkIf pkgs.stdenv.isDarwin { | ||||||||||
| enable = true; | ||||||||||
| config = { | ||||||||||
| ProgramArguments = [ | ||||||||||
| "${pkgs.bash}/bin/bash" | ||||||||||
| "${./upgrade.sh}" | ||||||||||
| ]; | ||||||||||
| RunAtLoad = true; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting RunAtLoad to true forces the upgrade script to execute immediately when the agent loads, violating the requirement that it should only run on the three-hour StartInterval. Prompt for AI agents
Suggested change
|
||||||||||
| KeepAlive = true; | ||||||||||
|
Comment on lines
+10
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
To ensure the service runs strictly every 3 hours as intended by
Comment on lines
+10
to
+11
|
||||||||||
| RunAtLoad = true; | |
| KeepAlive = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeepAlive=true makes launchd restart the brew-upgrader as soon as it exits, which prevents the StartInterval from spacing runs and effectively causes a continuous loop instead of one execution every three hours.
Prompt for AI agents
Address the following comment on home-manager/services/brew-upgrader/default.nix at line 11:
<comment>KeepAlive=true makes launchd restart the brew-upgrader as soon as it exits, which prevents the StartInterval from spacing runs and effectively causes a continuous loop instead of one execution every three hours.</comment>
<file context>
@@ -0,0 +1,17 @@
+ "${./upgrade.sh}"
+ ];
+ RunAtLoad = true;
+ KeepAlive = true;
+ StartInterval = 10800;
+ StandardOutPath = "/tmp/brew-upgrader.log";
</file context>
| KeepAlive = true; | |
| KeepAlive = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeepAlive causes nonstop brew upgrades
The launchd agent is configured with RunAtLoad = true; KeepAlive = true; StartInterval = 10800;, but launchd restarts a KeepAlive job immediately after it exits, so the three‑hour interval is effectively ignored. On macOS this agent will loop brew upgrade continuously instead of once every three hours, causing repeated upgrade attempts and log churn rather than the intended scheduled run.
Useful? React with 👍 / 👎.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,5 @@ | ||||||||||
| #!/usr/bin/env bash | ||||||||||
|
|
||||||||||
| set -euo pipefail | ||||||||||
|
|
||||||||||
| brew upgrade | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script calls To make the script more robust, you should prepend the common Homebrew binary directories to the
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Prompt for AI agents
Suggested change
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,10 @@ let | |
| dotfilesUpdater = import ./dotfiles-updater { inherit pkgs; }; | ||
| neversslKeepalive = import ./neverssl-keepalive { inherit pkgs; }; | ||
| # ollama = import ./ollama { inherit pkgs; }; # FIXME: ollama 0.12.11 has build issues with UI assets, uncomment when fixed | ||
| brewUpgrader = import ./brew-upgrader { inherit pkgs; }; | ||
| in | ||
| [ | ||
| brewUpgrader | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| codeSyncer | ||
| dotfilesUpdater | ||
| neversslKeepalive | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
brewcommand is not in the PATH. The script will fail with "brew: command not found" unless brew is already in the user's default environment. Add anEnvironment.PATHconfiguration similar to the code-syncer service to ensure brew can be found. For Homebrew on macOS, you likely need to include paths like/opt/homebrew/bin(Apple Silicon) or/usr/local/bin(Intel).