Skip to content
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

enable shell integration #39

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

dezren39
Copy link
Contributor

@dezren39 dezren39 commented Oct 23, 2024

fixes: #14

i considered a 'shell' attrset that had the per-shell enabled stuff in that, but decided to start simpler. there's at least one example like this in nixpkgs for the 'foot' program.

https://github.com/NixOS/nixpkgs/blob/ee8bdf4f09fdb4809ff8f2202decbfd02450edc3/nixos/modules/programs/foot/default.nix#L83

i left the integration enabled by default for all 3 main shell programs. i figure it's more common to want the commands that not.

i also considered that the content of brew shellenv could easily be generated from the prefix and other info already within the module.

If you would prefer that route I can rework this, I think as-is does work fine though and it aligns with some homebrew instructions.

per homebrew docs, homebrew stuff is installed in front of the existing nix path which should prevent brew programs from failing in strange ways.

Example content of my brew shellenv command output:

export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew/Library/.homebrew-is-managed-by-nix";
PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/Users/drewry.pope/.nix-profile/bin:/etc/profiles/per-user/drewry.pope/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"; export PATH;
[ -z "${MANPATH-}" ] || export MANPATH=":${MANPATH#:}";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

Definitely could generate this ourselves if we wanted.

I'm not sure if manpath and infopath are correct for nix.

testing done: i opened each shell and saw that 'cowsay' was accessible.

@AVGVSTVS96
Copy link

AVGVSTVS96 commented Nov 8, 2024

Are you sure zsh.interactiveShellInit and bash.interactiveShellInit exist as home-manager options? I can't get it to work in my config, I can only find fish.interactiveShellInit in home-manager options search and manual

Copy link
Owner

@zhaofengli zhaofengli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I was worried how it would interact with the Intel prefix (arch -x86_64 brew), but remembered our brew shim forces the correct HOMEBREW_PREFIX.

Are you sure zsh.interactiveShellInit and bash.interactiveShellInit exist as home-manager options?

This is a nix-darwin module, and nix-darwin docs are available here.

@zhaofengli zhaofengli merged commit b5224d5 into zhaofengli:main Nov 12, 2024
1 check passed
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.

homebrew prefix not in path
3 participants