Skip to content

Commit

Permalink
nix: Migrate Homebrew configuration to a new module structure and ena…
Browse files Browse the repository at this point in the history
…ble Homebrew for aarch64-darwin
  • Loading branch information
yousiki committed Nov 22, 2024
1 parent 7e8bbfb commit 4450547
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 33 deletions.
33 changes: 0 additions & 33 deletions modules/darwin/homebrew/default.nix

This file was deleted.

47 changes: 47 additions & 0 deletions modules/darwin/system/homebrew/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
lib,
config,
system,
namespace,
...
}: let
cfg = config.${namespace}.system.homebrew;
in {
options.${namespace}.system.homebrew = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to enable homebrew.";
};
};

config = lib.mkIf cfg.enable {
# Enable Homebrew for casks.
homebrew = {
enable = true;
# Upgrade and uninstall homebrew casks automatically.
onActivation = {
autoUpdate = true;
upgrade = true;
# cleanup = "uninstall";
};
};

# Add homebrew taps.
homebrew.taps = [
"buo/cask-upgrade"
];

# Set environment variables for homebrew mirror.
environment.variables = {
HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api";
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles";
HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git";
HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git";
HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
};

# Add homebrew to PATH.
environment.systemPath = lib.optional (system == "aarch64-darwin") "/opt/homebrew";
};
}
6 changes: 6 additions & 0 deletions systems/aarch64-darwin/nano/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
};
};

nichijou = {
system = {
homebrew.enable = true;
};
};

environment.systemPackages = with pkgs; [
alejandra
nodejs
Expand Down

0 comments on commit 4450547

Please sign in to comment.