Skip to content

Mic92/nix-casks

 
 

Repository files navigation

NixCasks

NixCasks is a tool that transforms Homebrew casks (GUI applications) recipes into Nix derivations, enabling users to install Homebrew casks directly without brew being installed.

Visit NixCasks website for more info and list of packages

Getting Started

NixCasks is a flake that exports compatible Homebrew cask through packages.<system>.<package>. NixCasks can be added to your flake via GitHub.

nix-casks = {
  url = "github:atahanyorganci/nix-casks/archive";
  inputs.nixpkgs.follows = "nixpkgs";
};

Installing packages is just adding it to environment.systemPackages for global and users.user.<name>.packages for per user on nix-darwin and home.packages via HomeManager.

home.packages = with inputs.nix-casks.packages.${pkgs.system}; [
  raycast
  slack
  visual-studio-code
  whatsapp
  brave-browser
  vlc
];

How it Works?

NixCasks parses the cask files mostly from https://formuale.brew.sh/api/cask.json and converts into JSON file that can be used in Nix derivation. JSON file contains basic package info (name, version, description, etc.), package source (mostly .dmg and .zip files) and install steps.

NixCasks provides unpack.sh that can extract applications from .dmg via hdiutil and other archive formats. Install steps are determined according to Cask Cookbook, for example moving /Name.app to $out/Applications/Name.app. Lastly, the package is linked from Nix store to the system, symlinked applications become discoverable by other applications (i.e. Spotlight, Raycast, etc.) as NixCasks respects the MacOS directory structure.

Note

NixCasks currently supports zip archives (.zip files) and disk images (.dmg files) in unpackPhase. Please contribute by creating an issue or PR with package name and source file format.

nix-casks Website and API

Official NixCasks website provides full list of available packages and hosts API to update the package repository. OpenAPI spec is available at /api/openapi and Scalar API reference is available at /api/reference.

Architecture

The website is server rendered Astro app hosted on Vercel. The tech stack is as follows.

Limitations

  • .pkg files are unsupported, as it requires sudo privileges to be executed.
  • Other archive formats may not be supported.

Authors

About

Homebrew Cask packages available as Nix derivations for macOS with nix-darwin.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 70.9%
  • Astro 19.6%
  • Nix 3.9%
  • JavaScript 2.4%
  • Shell 1.3%
  • Just 1.3%
  • CSS 0.6%