Experimental nix expression to package all MacOS casks from homebrew automatically
Nix
377
81 commits
updated Sep 1, 2026
An experimental nix expression as a nixpkgs overlay to package all macOS Homebrew Casks automatically.
nix run won't work, you'll have to build them first.nix build github:BatteredBunny/brew-nix#blender
./result/Applications/Blender.app/Contents/MacOS/Blender
or declaratively
home.packages = [ pkgs.brewCasks.visual-studio-code ];
Many casks do not come with their hash so you'll have to provide one explicitly.
home.packages = with pkgs; [
(brewCasks.marta.overrideAttrs (oldAttrs: {
src = pkgs.fetchurl {
url = builtins.head oldAttrs.src.urls;
hash = lib.fakeHash; # Replace with actual hash after building once
};
}))
];
On x86_64, brew-nix tries to automatically choose the newest intel macOS variant available, that may not be correct though, in those cases it maybe be needed to manually override the cask variant chosen. You can look up each cask's respective variations at brew.sh.
home.packages = lib.attrsets.attrValues {
vscode = (pkgs.brewCasks.visual-studio-code.override {variation = "sequoia";});
};
home.packages = lib.attrsets.attrValues {
vscode = (pkgs.brewCasks.visual-studio-code.override {variation = "sequoia";}).overrideAttrs (oldAttrs: {
src = pkgs.fetchurl {
url = lib.lists.head oldAttrs.src.urls;
hash = lib.fakeHash; # Replace with actual hash after building once
};
});
};
brew-nix is structured into 2 repos for modularity:
brew-nix containg the nix expression to parse cask data to nix packages.brew-api repo containing the brew casks summary information.This has the benefit of being able to keep the git history of brew-nix clean, and giving the user the freedom to easily override the data used to generate the nix expressions and or update brew-api seperatly from brew-nix if needed.
[!WARNING]
brew-apiinput part is not optional. You should define your ownbrew-apiinput like below.If you omit it,
brew-nixwill use a stale version ofbrew-apiwhich is updated infrequently and may not work.
See examples/flake.nix.
# flake.nix
inputs = {
brew-nix = {
url = "github:BatteredBunny/brew-nix";
inputs.brew-api.follows = "brew-api";
};
brew-api = {
url = "github:BatteredBunny/brew-api";
flake = false;
};
};
# home.nix
nixpkgs = {
overlays = [
inputs.brew-nix.overlays.default
];
};
home.packages = with pkgs; [
brewCasks.marta
brewCasks."firefox@developer-edition" # Casks with special characters in their name need to be defined in quotes
];
Nix
57.2%
Python
42.7%
Experimental nix expression to package all MacOS casks from homebrew automatically
Nix
377
81 commits
updated Sep 1, 2026
An experimental nix expression as a nixpkgs overlay to package all macOS Homebrew Casks automatically.
nix run won't work, you'll have to build them first.nix build github:BatteredBunny/brew-nix#blender
./result/Applications/Blender.app/Contents/MacOS/Blender
or declaratively
home.packages = [ pkgs.brewCasks.visual-studio-code ];
Many casks do not come with their hash so you'll have to provide one explicitly.
home.packages = with pkgs; [
(brewCasks.marta.overrideAttrs (oldAttrs: {
src = pkgs.fetchurl {
url = builtins.head oldAttrs.src.urls;
hash = lib.fakeHash; # Replace with actual hash after building once
};
}))
];
On x86_64, brew-nix tries to automatically choose the newest intel macOS variant available, that may not be correct though, in those cases it maybe be needed to manually override the cask variant chosen. You can look up each cask's respective variations at brew.sh.
home.packages = lib.attrsets.attrValues {
vscode = (pkgs.brewCasks.visual-studio-code.override {variation = "sequoia";});
};
home.packages = lib.attrsets.attrValues {
vscode = (pkgs.brewCasks.visual-studio-code.override {variation = "sequoia";}).overrideAttrs (oldAttrs: {
src = pkgs.fetchurl {
url = lib.lists.head oldAttrs.src.urls;
hash = lib.fakeHash; # Replace with actual hash after building once
};
});
};
brew-nix is structured into 2 repos for modularity:
brew-nix containg the nix expression to parse cask data to nix packages.brew-api repo containing the brew casks summary information.This has the benefit of being able to keep the git history of brew-nix clean, and giving the user the freedom to easily override the data used to generate the nix expressions and or update brew-api seperatly from brew-nix if needed.
[!WARNING]
brew-apiinput part is not optional. You should define your ownbrew-apiinput like below.If you omit it,
brew-nixwill use a stale version ofbrew-apiwhich is updated infrequently and may not work.
See examples/flake.nix.
# flake.nix
inputs = {
brew-nix = {
url = "github:BatteredBunny/brew-nix";
inputs.brew-api.follows = "brew-api";
};
brew-api = {
url = "github:BatteredBunny/brew-api";
flake = false;
};
};
# home.nix
nixpkgs = {
overlays = [
inputs.brew-nix.overlays.default
];
};
home.packages = with pkgs; [
brewCasks.marta
brewCasks."firefox@developer-edition" # Casks with special characters in their name need to be defined in quotes
];
Nix
57.2%
Python
42.7%