Move brew path into home.sessionVariables

Also, instead of checking for both directories each time, just do an
architecture check during build and add the path blindly.
main
Bo Jeanes 2024-07-19 16:01:54 +10:00
parent a97fed5d86
commit 9ccc82c1cc
No known key found for this signature in database
1 changed files with 11 additions and 13 deletions

View File

@ -339,24 +339,22 @@
linux = { };
# home-manager config specific to Darwin
darwin = let
addBrewPath = ''
# Apple Silicon
[ -d /opt/homebrew/bin ] && export PATH="/opt/homebrew/bin:$PATH"
[ -d /opt/homebrew/sbin ] && export PATH="/opt/homebrew/sbin:$PATH"
# Intel
[ -d /usr/local/bin ] && export PATH="/usr/local/bin:$PATH"
[ -d /usr/local/sbin ] && export PATH="/usr/local/sbin:$PATH"
'';
in {
darwin = { pkgs, ... }: {
# Yank/paste in Neovim to/from macOS clipboard by default
programs.nixvim.clipboard.register = "unnamedplus";
programs.git.extraConfig."gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
programs.bash.initExtra = addBrewPath;
programs.zsh.initExtra = addBrewPath;
home.sessionVariables =
let
brewPrefix =
if pkgs.stdenv.hostPlatform.isAarch64
then "/opt/homebrew"
else "/usr/local";
in
{
PATH = "${brewPrefix}/bin:${brewPrefix}/sbin:$PATH";
};
};
};
};