Skip to content

Commit

Permalink
Merge pull request #23 from zhaofengli/brew-4.3.1
Browse files Browse the repository at this point in the history
brew-src: 4.2.16 -> 4.3.1
  • Loading branch information
zhaofengli authored May 27, 2024
2 parents 445f798 + fe640d4 commit 31e9c81
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
1 change: 1 addition & 0 deletions ci/activate-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ systemProfile=$(nix build "./${DIR}/..#darwinConfigurations.ci.${example}.system

>&2 echo "Built $systemProfile"

sudo rm "/etc/nix/nix.conf"
sudo "$systemProfile/activate"
"$systemProfile/activate-user"

Expand Down
26 changes: 13 additions & 13 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
nix-darwin.url = "github:LnL7/nix-darwin";
flake-utils.url = "github:numtide/flake-utils";
brew-src = {
url = "github:Homebrew/brew/4.2.16";
url = "github:Homebrew/brew/4.3.1";
flake = false;
};
};
Expand Down
1 change: 1 addition & 0 deletions modules/brew.tail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ MANPAGE_VARS=(
BAT_CONFIG_PATH
BAT_THEME
BROWSER
BUNDLE_USER_CACHE
DISPLAY
EDITOR
NO_COLOR
Expand Down
10 changes: 6 additions & 4 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ let
tools = pkgs.callPackage ../pkgs { };

brew = if cfg.patchBrew then patchBrew cfg.package else cfg.package;
ruby = pkgs.ruby_3_3;

# Sadly, we cannot replace coreutils since the GNU implementations
# behave differently.
Expand Down Expand Up @@ -285,9 +286,7 @@ let
/bin/ln -shf "${env}" "$HOMEBREW_LIBRARY/Taps"
'';

patchBrew = brew: let
pinnedRuby = "${pkgs.ruby}/bin/ruby";
in pkgs.runCommandLocal "${brew.name or "brew"}-patched" {} (''
patchBrew = brew: pkgs.runCommandLocal "${brew.name or "brew"}-patched" {} (''
cp -r "${brew}" "$out"
chmod u+w "$out" "$out/Library/Homebrew/cmd"
Expand All @@ -299,13 +298,16 @@ let
ruby_sh="$out/Library/Homebrew/utils/ruby.sh"
if [[ -e "$ruby_sh" ]] && grep "setup-ruby-path" "$ruby_sh"; then
chmod u+w "$ruby_sh"
echo -e "setup-ruby-path() { export HOMEBREW_RUBY_PATH=\"${pinnedRuby}\"; }" >>"$ruby_sh"
echo -e "setup-ruby-path() { export HOMEBREW_RUBY_PATH=\"${ruby}/bin/ruby\"; }" >>"$ruby_sh"
fi
'' + lib.optionalString (brew ? version) ''
# Embed version number instead of checking with git
brew_sh="$out/Library/Homebrew/brew.sh"
chmod u+w "$out/Library/Homebrew" "$brew_sh"
sed -i -e 's/^HOMEBREW_VERSION=.*/HOMEBREW_VERSION="${brew.version}"/g' "$brew_sh"
# 4.3.1: Clear GIT_REVISION to bypass caching mechanism
sed -i -e 's/^GIT_REVISION=.*/GIT_REVISION=""; HOMEBREW_VERSION="${brew.version}"/g' "$brew_sh"
'');
in {
options = {
Expand Down

0 comments on commit 31e9c81

Please sign in to comment.