-
Notifications
You must be signed in to change notification settings - Fork 0
feat(roborev): add roborev code review daemon service #1745
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,8 @@ | ||
| #!/usr/bin/env bash | ||
| # Create roborev data directory with correct permissions | ||
| # Usage: activate.sh <data_dir> | ||
| set -euo pipefail | ||
| DATA_DIR="$1" | ||
|
|
||
| mkdir -p "$DATA_DIR" | ||
| chmod 700 "$DATA_DIR" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||
| { | ||||||
| config, | ||||||
| lib, | ||||||
| pkgs, | ||||||
| inputs, | ||||||
| ... | ||||||
| }: | ||||||
| let | ||||||
| inherit (inputs.host) isGalactica isMatic; | ||||||
| homeDir = config.home.homeDirectory; | ||||||
| roborevBin = "${homeDir}/.local/bin/roborev"; | ||||||
| dataDir = "${homeDir}/.roborev"; | ||||||
| enabled = isGalactica || isMatic; | ||||||
| in | ||||||
| lib.mkIf enabled { | ||||||
| home.activation.roborevSetup = lib.hm.dag.entryAfter [ "writeBoundary" ] '' | ||||||
| $DRY_RUN_CMD ${pkgs.bash}/bin/bash "${./activate.sh}" "${dataDir}" | ||||||
| ''; | ||||||
|
|
||||||
| launchd.agents.roborev = lib.mkIf pkgs.stdenv.isDarwin { | ||||||
| enable = true; | ||||||
| config = { | ||||||
| ProgramArguments = [ | ||||||
| roborevBin | ||||||
| "daemon" | ||||||
| "run" | ||||||
| ]; | ||||||
| KeepAlive = true; | ||||||
| RunAtLoad = true; | ||||||
| EnvironmentVariables = { | ||||||
| HOME = homeDir; | ||||||
| ROBOREV_DATA_DIR = dataDir; | ||||||
| PATH = "${homeDir}/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"; | ||||||
|
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. P2: Include the Home Manager profile bin directory in the launchd PATH; otherwise the daemon may not find tools installed via Nix profile. Prompt for AI agents |
||||||
| }; | ||||||
| StandardOutPath = "/tmp/roborev.log"; | ||||||
| StandardErrorPath = "/tmp/roborev.error.log"; | ||||||
|
Comment on lines
+35
to
+36
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. Using |
||||||
| }; | ||||||
| }; | ||||||
|
|
||||||
| systemd.user.services.roborev = lib.mkIf pkgs.stdenv.isLinux { | ||||||
| Unit = { | ||||||
| Description = "roborev code review daemon"; | ||||||
| Documentation = [ "https://github.com/roborev-dev/roborev" ]; | ||||||
| After = [ "network.target" ]; | ||||||
| }; | ||||||
| Service = { | ||||||
| Type = "notify"; | ||||||
|
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.
Failure mode with an older binary on matic: systemd waits Options:
|
||||||
| ExecStart = "${roborevBin} daemon run"; | ||||||
|
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. |
||||||
| Restart = "on-failure"; | ||||||
|
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. Restart semantics diverge between platforms. On galactica, The sibling services this PR mirrors (
Suggested change
|
||||||
| RestartSec = 5; | ||||||
| Environment = [ | ||||||
| "HOME=${homeDir}" | ||||||
| "ROBOREV_DATA_DIR=${dataDir}" | ||||||
| "PATH=${homeDir}/.local/bin:${homeDir}/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin" | ||||||
|
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. |
||||||
| ]; | ||||||
| }; | ||||||
| Install = { | ||||||
| WantedBy = [ "default.target" ]; | ||||||
| }; | ||||||
| }; | ||||||
| } | ||||||
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
PATHfor the Darwinlaunchdagent is missing the Nix profile directory. This will likely cause the daemon to fail if it depends on tools installed via Nix (such asgit). Additionally, usingconfig.home.profileDirectoryis more idiomatic than hardcoding.nix-profile.