Add homebrew
This commit is contained in:
parent
d81c541c97
commit
2a2e053d62
6 changed files with 88 additions and 3 deletions
36
flake.lock
generated
36
flake.lock
generated
|
|
@ -1,5 +1,22 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"brew-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1753461463,
|
||||||
|
"narHash": "sha256-kGc7pRH0diLzKmOHsEFA8sZ9NJpgT+tqxAMsuqNd5Po=",
|
||||||
|
"owner": "Homebrew",
|
||||||
|
"repo": "brew",
|
||||||
|
"rev": "4d14be89e99a45181c18e96a5f19a5b43343cc0f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Homebrew",
|
||||||
|
"ref": "4.5.13",
|
||||||
|
"repo": "brew",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"claude-code": {
|
"claude-code": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
|
|
@ -167,6 +184,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-homebrew": {
|
||||||
|
"inputs": {
|
||||||
|
"brew-src": "brew-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754250993,
|
||||||
|
"narHash": "sha256-MEin+qoQKtFC1b0f4tnQ+Z82BQWSCgh6Ef7rpmH9gig=",
|
||||||
|
"owner": "zhaofengli",
|
||||||
|
"repo": "nix-homebrew",
|
||||||
|
"rev": "314d057294e79bc2596972126b84c6f9f144499a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "zhaofengli",
|
||||||
|
"repo": "nix-homebrew",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1753432016,
|
"lastModified": 1753432016,
|
||||||
|
|
@ -251,6 +286,7 @@
|
||||||
"firefox-addons": "firefox-addons",
|
"firefox-addons": "firefox-addons",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nix-homebrew": "nix-homebrew",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixvim": "nixvim"
|
"nixvim": "nixvim"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
flake.nix
13
flake.nix
|
|
@ -14,9 +14,10 @@
|
||||||
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons }:
|
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, nix-homebrew }:
|
||||||
let
|
let
|
||||||
configuration = { pkgs, ... }: {
|
configuration = { pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -103,11 +104,17 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
darwinConfigurations."iMac" = nix-darwin.lib.darwinSystem {
|
darwinConfigurations."iMac" = nix-darwin.lib.darwinSystem {
|
||||||
modules = [ configuration ];
|
modules = [
|
||||||
|
configuration
|
||||||
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
darwinConfigurations."MacBook-Air" = nix-darwin.lib.darwinSystem {
|
darwinConfigurations."MacBook-Air" = nix-darwin.lib.darwinSystem {
|
||||||
modules = [ configuration ];
|
modules = [
|
||||||
|
configuration
|
||||||
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
homeConfigurations.yanlin = home-manager.lib.homeManagerConfiguration {
|
homeConfigurations.yanlin = home-manager.lib.homeManagerConfiguration {
|
||||||
|
|
|
||||||
24
modules/homebrew.nix
Normal file
24
modules/homebrew.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Homebrew configuration for package management
|
||||||
|
homebrew = {
|
||||||
|
enable = true;
|
||||||
|
onActivation = {
|
||||||
|
autoUpdate = true;
|
||||||
|
cleanup = "zap"; # Removes unlisted formulae/casks
|
||||||
|
upgrade = true;
|
||||||
|
};
|
||||||
|
brews = [
|
||||||
|
# Command-line tools go here
|
||||||
|
# Example: "wget"
|
||||||
|
];
|
||||||
|
casks = [
|
||||||
|
# GUI applications go here
|
||||||
|
# Example: "google-chrome"
|
||||||
|
];
|
||||||
|
taps = [
|
||||||
|
# Additional repositories if needed
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
11
modules/nix-homebrew.nix
Normal file
11
modules/nix-homebrew.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# nix-homebrew configuration for declarative Homebrew installation
|
||||||
|
nix-homebrew = {
|
||||||
|
enable = true;
|
||||||
|
enableRosetta = true; # Apple Silicon support
|
||||||
|
user = "yanlin";
|
||||||
|
autoMigrate = true; # Migrate existing Homebrew if present
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -113,6 +113,8 @@ in
|
||||||
|
|
||||||
app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \
|
find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \
|
||||||
|
find -L /opt/homebrew/Caskroom -name "*.app" -maxdepth 3 2>/dev/null; \
|
||||||
|
find -L /usr/local/Caskroom -name "*.app" -maxdepth 3 2>/dev/null; \
|
||||||
find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) |
|
find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) |
|
||||||
sort | uniq |
|
sort | uniq |
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
../modules/homebrew.nix
|
||||||
|
../modules/nix-homebrew.nix
|
||||||
|
];
|
||||||
|
|
||||||
# Set primary user for system preferences
|
# Set primary user for system preferences
|
||||||
system.primaryUser = "yanlin";
|
system.primaryUser = "yanlin";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue