Skip to content

Add git to crane dev shells - #1969

Open
AdamuAbba wants to merge 1 commit into
payjoin:masterfrom
AdamuAbba:nix-git-fix
Open

AdamuAbba wants to merge 1 commit into
payjoin:masterfrom
AdamuAbba:nix-git-fix

Conversation

@AdamuAbba

Copy link
Copy Markdown
Contributor

closes #1906.

On macOS, /usr/bin/git is Apple's xcode-select shim, which locates the real binary through DEVELOPER_DIR. Nix's Darwin stdenv sets DEVELOPER_DIR to its pinned Apple SDK, which ships only xcrun, so git fails with error: tool 'git' not found inside the dev shells. This includes the default shell that .envrc loads, so direnv users like myself have no working git in the project directory.

This adds git to the shared crane devShell packages, the same way releaseDevShell already does. Nix's git then comes before the shim on PATH. Because the crane shells are generated from one definition, this one line covers default, nightly, stable and msrv. Nix's git also ships git-credential-osxkeychain, so the macOS keychain credential helper keeps working.

The language shells are left alone on purpose. They are used to build and test the bindings.

Testing

This only affects Macs where Apple's /usr/bin/git shim is the first git on PATH (details). Run nix develop -c which -a git and check the first line:

  • On master: if it's /usr/bin/git, your Mac is affected.
  • On this branch: it should be a /nix/store/...-git-2.51.2/bin/git path.

On an affected Mac, git now works in default, nightly, stable and msrv.

Reviewer: @xstoicunicornx

Disclosure: co-authored by Claude Code

Pull Request Checklist

Please confirm the following before requesting review:

On macOS, /usr/bin/git is an xcode-select shim that locates the real
binary via DEVELOPER_DIR. Nix's Darwin stdenv points DEVELOPER_DIR at
its pinned Apple SDK, which contains only xcrun, so git fails with
"tool 'git' not found" inside the dev shells.

Adding git to the shared crane devShell packages puts nix's git ahead
of the shim on PATH. This covers the default, nightly, stable and msrv
shells.

Signed-off-by: shytypes <abbaadamu302@icloud.com>
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 38271540532

Coverage remained the same at 87.494%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 17848
Covered Lines: 15616
Line Coverage: 87.49%
Coverage Strength: 319.88 hits per line

💛 - Coveralls

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MacOS Only: git is unavailable inside every nix dev shell except .#release

3 participants