Go path rename - #683
Conversation
|
You do not have enough credits to review this pull request. Please purchase more credits to continue. |
Mesa DescriptionTL;DRStandardized Go paths for macOS GUI applications and refactored Home Manager configuration modules to use direct file sources instead of out-of-store symlinks. What changed?
Description generated by Mesa. Update settings |
Summary of ChangesHello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on two areas: simplifying Nix configuration file sourcing by removing redundant Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughReplaces many uses of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces two main changes: a widespread refactoring of Nix configurations to use direct source attributes instead of config.lib.file.mkOutOfStoreSymlink, and the standardization of Go environment variables for macOS GUI applications. The refactoring is a positive change, simplifying the configuration and aligning it better with Nix best practices. The addition of Go-related environment variables for launchd is also a good step towards ensuring tools are available in GUI apps. However, I've identified an issue with the hardcoded PATH variable, which is not robust and will likely fail on Apple Silicon Macs. I've provided a suggestion to improve this. Overall, the changes are beneficial but the PATH definition needs adjustment.
| SHELL = "${pkgs.bash}/bin/bash"; | ||
| GOROOT = "/etc/go-root"; | ||
| GOPATH = "/Users/${username}/go"; | ||
| PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; |
There was a problem hiding this comment.
Hardcoding the PATH variable is brittle and can lead to issues on different system architectures. For instance, this PATH is missing /opt/homebrew/bin, which is the standard location for Homebrew on Apple Silicon (aarch64) Macs. This could cause tools installed via Homebrew to be unavailable in GUI applications.
I suggest making the PATH definition more robust by conditionally including the Homebrew path for aarch64 systems. While it's generally best to avoid hardcoded paths in Nix, this change would at least account for different architectures.
PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin" + (if pkgs.stdenv.isAarch64 then ":/opt/homebrew/bin" else "") + ":/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
There was a problem hiding this comment.
Pull request overview
Updates the macOS (nix-darwin) Go environment for GUI apps and switches many Home Manager/config file sources from out-of-store symlinks to store-backed paths.
Changes:
- Add
GOROOT,GOPATH, andPATHtolaunchd.user.envVariables, and expose a stable Go root under/etc/go-root. - Disable nix-darwin documentation generation (to avoid an options.json warning per comment).
- Replace
config.lib.file.mkOutOfStoreSymlinkusages with directsource = ./...across multiple Home Manager/config modules.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| nix-darwin/config/system.nix | Sets Go-related env vars for GUI apps; adds /etc/go-root mapping; disables documentation. |
| home-manager/programs/ssh/default.nix | Switch .ssh/rc to store-backed source = ./rc. |
| home-manager/programs/neovim/default.nix | Switch Neovim init.lua to store-backed source. |
| home-manager/programs/fish/default.nix | Switch fish theme/completions sources to store-backed paths. |
| config/zellij/default.nix | Switch zellij config sources to store-backed paths. |
| config/starship/default.nix | Switch starship config source to store-backed path. |
| config/serena/default.nix | Switch serena config source to store-backed path. |
| config/pi/default.nix | Switch pi agent config sources to store-backed paths. |
| config/opencode/default.nix | Switch opencode config source to store-backed path. |
| config/llm/default.nix | Switch llm config sources to store-backed paths (Darwin/Linux conditional targets). |
| config/k3s/default.nix | Switch k3s config source to store-backed path. |
| config/jj/default.nix | Switch jj config source to store-backed path. |
| config/hammerspoon/default.nix | Switch hammerspoon init.lua source to store-backed path. |
| config/ghostty/default.nix | Switch ghostty config source to store-backed path. |
| config/factory/default.nix | Switch factory config source to store-backed path. |
| config/direnv/default.nix | Switch direnvrc source to store-backed path. |
| config/crush/default.nix | Switch crush config source to store-backed path. |
| config/codex/default.nix | Switch codex config source to store-backed path. |
| config/cliproxyapi/default.nix | Switch cli-proxy-api config sources to store-backed paths. |
| config/amp/default.nix | Switch amp settings source to store-backed path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| xdg.configFile = { | ||
| "fish/themes/dracula.theme".source = ./dracula.theme; | ||
| "fish/completions".source = config.lib.file.mkOutOfStoreSymlink ./completions; | ||
| "fish/completions".source = ./completions; |
There was a problem hiding this comment.
xdg.configFile."fish/completions".source points to a directory, but this entry doesn’t set recursive = true. Home Manager typically errors when a directory is used as a source without recursive. Add recursive = true (or revert to an approach that results in a single-file symlink) so the activation/build succeeds.
| "fish/completions".source = ./completions; | |
| "fish/completions" = { | |
| source = ./completions; | |
| recursive = true; | |
| }; |
| GOROOT = "/etc/go-root"; | ||
| GOPATH = "/Users/${username}/go"; | ||
| PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; | ||
| }; |
There was a problem hiding this comment.
This sets PATH explicitly for all GUI apps via launchd, which overwrites any existing PATH from the system/user environment. This is brittle (e.g., can drop paths like Homebrew’s /opt/homebrew/bin on Apple Silicon) and can cause GUI/terminal PATH divergence. Prefer constructing PATH from the existing system paths (or using nix-darwin’s path/systemPath mechanisms) rather than hardcoding a full PATH here.
| # Avoid nixpkgs options.json warning during docs generation. | ||
| documentation.enable = false; |
There was a problem hiding this comment.
documentation.enable = false; globally disables documentation generation/installation for this nix-darwin system, which can remove manpages/docs for interactive use. If the intent is only to silence a docs-generation warning in CI, consider gating this on the relevant build context (e.g., runner/CI) or addressing the underlying warning instead of disabling docs unconditionally.
| source = ./config.template.yaml; | ||
| force = true; | ||
| }; | ||
| # Example config - required by cliproxyapi's object-backed config bootstrap |
There was a problem hiding this comment.
The comment says this is an "Example config", but the source is ./config.template.yaml and there is no separate example file in this directory. Either update the comment to reflect that this is intentionally the template, or add a real config.example.yaml and source that instead.
| # Example config - required by cliproxyapi's object-backed config bootstrap | |
| # Example config (intentionally copied from config.template.yaml) - required by cliproxyapi's object-backed config bootstrap |
| home.file.".config/starship.toml" = { | ||
| source = config.lib.file.mkOutOfStoreSymlink ./starship.toml; | ||
| source = ./starship.toml; | ||
| force = true; | ||
| }; |
There was a problem hiding this comment.
PR title suggests this change is about a Go path rename, but this file change is part of a broader sweep replacing mkOutOfStoreSymlink with direct source = ./... across many modules. Consider updating the PR title/description to reflect the larger scope (or splitting into separate PRs) to make review and rollback safer.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@nix-darwin/config/system.nix`:
- Around line 9-15: launchd.user.envVariables.PATH is missing Homebrew locations
so GUI apps get a different PATH; update the PATH value in
launchd.user.envVariables to include /opt/homebrew/bin and /opt/homebrew/sbin
(preferably prepended or included alongside the existing entries) while keeping
the existing per-user /Users/${username}/go and /etc/per-user entries and the
${username} expansion intact so GUI apps like VS Code see the same Homebrew
tools as your shell.
🧹 Nitpick comments (10)
config/opencode/default.nix (1)
1-6: Unusedconfigparameter can be removed.Since
config.lib.file.mkOutOfStoreSymlinkis no longer used, theconfigparameter is now unused.🧹 Suggested cleanup
-{ config, ... }: +{ ... }: { home.file.".config/opencode/opencode.jsonc" = { source = ./opencode.jsonc; force = true; }; }config/starship/default.nix (1)
1-6: Unusedconfigparameter can be removed.The
configparameter is no longer referenced after switching to a direct path.🧹 Suggested cleanup
-{ config, ... }: +{ ... }: { home.file.".config/starship.toml" = { source = ./starship.toml; force = true; }; }config/ghostty/default.nix (1)
1-5: Unusedconfigparameter can be removed.The
configparameter is no longer referenced after switching to a direct path.🧹 Suggested cleanup
-{ config, ... }: +{ ... }: { xdg.configFile."ghostty/config" = { source = ./config; }; }config/serena/default.nix (1)
1-6: Unusedconfigparameter can be removed.The
configparameter is no longer referenced after switching to a direct path.🧹 Suggested cleanup
-{ config, ... }: +{ ... }: { home.file.".serena/serena_config.yml" = { source = ./serena_config.yml; force = true; }; }config/jj/default.nix (1)
1-5: Unusedconfigparameter can be removed.The
configparameter is no longer referenced after switching to a direct path.🧹 Suggested cleanup
-{ config, ... }: +{ ... }: { xdg.configFile."jj/config.toml" = { source = ./config.toml; }; }config/pi/default.nix (1)
1-1: Remove unusedconfigparameter.The
configparameter is no longer used after removing themkOutOfStoreSymlinkcalls. It should be removed to keep the module clean.♻️ Proposed fix
-{ config, ... }: +{ ... }:config/llm/default.nix (1)
1-1: Remove unusedconfigparameter.The
configparameter is no longer used after removing themkOutOfStoreSymlinkcalls.♻️ Proposed fix
-{ config, pkgs, ... }: +{ pkgs, ... }:home-manager/programs/ssh/default.nix (1)
1-1: Remove unusedconfigparameter.The
configparameter is no longer used after removing themkOutOfStoreSymlinkcall.♻️ Proposed fix
-{ config, ... }: +{ ... }:config/factory/default.nix (1)
1-1: Remove unusedconfigparameter.The
configparameter is no longer used after removing themkOutOfStoreSymlinkcall.♻️ Proposed fix
-{ config, ... }: +{ ... }:config/cliproxyapi/default.nix (1)
1-1: Remove unusedconfigparameter.The
configparameter is no longer used after removing themkOutOfStoreSymlinkcalls.♻️ Proposed fix
-{ config, ... }: +{ ... }:
| # Set environment variables for GUI applications (VS Code, etc.) | ||
| launchd.user.envVariables = { | ||
| SHELL = "${pkgs.bash}/bin/bash"; | ||
| GOROOT = "/etc/go-root"; | ||
| GOPATH = "/Users/${username}/go"; | ||
| PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; | ||
| }; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n nix-darwin/config/system.nixRepository: shunkakinoki/dotfiles
Length of output: 3109
🏁 Script executed:
# Search for Homebrew references in the repository
rg -i homebrew --type nix -A 2 -B 2 | head -100Repository: shunkakinoki/dotfiles
Length of output: 6027
🏁 Script executed:
# Look for shell configuration files
fd -e "zshrc|bashrc|profile|shellrc" . | head -20Repository: shunkakinoki/dotfiles
Length of output: 47
🏁 Script executed:
# Check if there's a home-manager config or other shell init
rg "shell\s*=" --type nix -A 3 | head -100Repository: shunkakinoki/dotfiles
Length of output: 302
🏁 Script executed:
cat -n nix-darwin/config/homebrew.nixRepository: shunkakinoki/dotfiles
Length of output: 3214
Add Homebrew paths to GUI PATH for consistency with shell environment.
launchd.user.envVariables.PATH omits /opt/homebrew/bin and /opt/homebrew/sbin, while your shell init files explicitly add them. This means GUI applications (like VS Code) will have a different PATH than your shell sessions, preventing them from accessing Homebrew-installed tools even though they're available in terminal sessions.
Suggested adjustment
- PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
+ PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Set environment variables for GUI applications (VS Code, etc.) | |
| launchd.user.envVariables = { | |
| SHELL = "${pkgs.bash}/bin/bash"; | |
| GOROOT = "/etc/go-root"; | |
| GOPATH = "/Users/${username}/go"; | |
| PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; | |
| }; | |
| # Set environment variables for GUI applications (VS Code, etc.) | |
| launchd.user.envVariables = { | |
| SHELL = "${pkgs.bash}/bin/bash"; | |
| GOROOT = "/etc/go-root"; | |
| GOPATH = "/Users/${username}/go"; | |
| PATH = "/Users/${username}/go/bin:/etc/profiles/per-user/${username}/bin:/run/current-system/sw/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; | |
| }; |
🤖 Prompt for AI Agents
In `@nix-darwin/config/system.nix` around lines 9 - 15,
launchd.user.envVariables.PATH is missing Homebrew locations so GUI apps get a
different PATH; update the PATH value in launchd.user.envVariables to include
/opt/homebrew/bin and /opt/homebrew/sbin (preferably prepended or included
alongside the existing entries) while keeping the existing per-user
/Users/${username}/go and /etc/per-user entries and the ${username} expansion
intact so GUI apps like VS Code see the same Homebrew tools as your shell.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="config/codex/config.toml">
<violation number="1" location="config/codex/config.toml:8">
P2: `suppress_unstable_features_warning` is documented under the `[notice]` table, not as a top‑level key. As added, it may be ignored or rejected, leaving the warning behavior unchanged.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Note
Medium Risk
Mostly mechanical Nix/Home Manager refactors, but it changes how config files are sourced (store vs out-of-store) and adjusts macOS GUI app environment variables, which could affect developer tooling paths.
Overview
Replaces
config.lib.file.mkOutOfStoreSymlinkwith directsource = ./…references across many Home Manager config modules (e.g.,amp,cliproxyapi,llm,zellij,ssh,neovim,fish), changing how these dotfiles are linked into the home directory.On nix-darwin, adds Go-related GUI environment setup by exporting
GOROOT,GOPATH, and an explicitPATH, creates/etc/go-rootfrom the Nix Go package, and disablesdocumentationto avoid anoptions.jsonwarning during docs generation.Written by Cursor Bugbot for commit 7250c38. Configure here.
Summary by cubic
Standardized Go paths for macOS GUI apps and replaced out-of-store symlinks with direct file sources. This fixes PATH visibility for VS Code and similar apps and makes config management more reliable.
Bug Fixes
Refactors
Written for commit 318584a. Summary will update on new commits.