Repository navigation
feat: add Nix flake support for one-command installation #56931
Description
Summary
This issue tracks adding Nix flake support so users can install and run Brave directly from GitHub without cloning or compiling manually.
What Nix provides
- Pure / Hermetic builds: every input — the prebuilt binary, glibc/libiconv, system libraries — is pinned in
flake.lock. If it builds today, it builds in ten years. - Reproducible: the exact same derivation always produces the exact same output bit-for-bit (modulo timestamps). No "works on my machine."
- Idempotent installs: running
nix profile installtwice is a no-op. The system reaches the declared state and stays there. - Rollback-able:
nix profile rollbackrestores the previous profile generation instantly. Broken update? One command back. - Declarative: the entire build is a single expression (
flake.nix). No imperativeapt install,brew installdance. - Cross-platform: same
nix run github:brave/brave-browserworks on macOS (Apple Silicon & Intel) and Linux. The flake handles platform-specific dependencies. - Zero-install runs:
nix runfetches from binary cache when available. No clone, no compile. - No system pollution:
nix profile installadds to a user-specific profile. Uninstall cleanly withnix profile remove. No orphaned global packages. - Atomic upgrades / downgrades: profiles are switched atomically. No half-upgraded state.
Current gap
The project publishes prebuilt release artifacts (.deb for Linux, .zip for macOS) on the releases page, and nixpkgs already packages Brave via make-brave.nix. But there is no repo-owned flake, so users must rely on the nixpkgs channel's version (which lags behind upstream releases) or install manually.
Proposed change
- Add
flake.nixthat wraps the prebuilt release binary (reusing nixpkgs'bravepackaging viaoverrideAttrsto swap in upstream version + per-platform SRI hashes). This avoids duplicating ~150 lines of patchelf/wrapGApps/desktop-fixup logic that nixpkgs already maintains. - Add
.github/workflows/nix-release.yml: a scheduled lag-check that auto-bumpsversion+ per-platformsha256hashes inflake.nixand opens a PR when the flake falls behind the latest stable release. Zero per-release manual maintenance. - Add
devbox.jsonfor reproducible development environments. - Update
README.mdwith a Nix installation subsection. - Update
.gitignorewith Nix build result symlinks.
Note: this is a Prebuilt Tarball Flake — it wraps the release binaries, it does not build from source (building Chromium/Brave from source is a different undertaking and lives in brave-core). Tag-pinning (github:brave/brave-browser/vX.Y.Z) does not work because the hash bump lands after the release tag is cut; use the default branch ref or a commit SHA for reproducibility.
Branch
feat-nix-package-manager-install on the fork.
Implementation
I have prepared the implementation in my fork at:
https://github.com/levonk/brave-browser/tree/feat-nix-package-manager-install
The changes include:
flake.nix: Nix flake wrapping the prebuilt release binary aspackages.<system>.defaultandapps.<system>.default, reusing nixpkgsbravepackagingflake.lock: pinnednixpkgs-unstableinput.github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumpsversion+ per-platform SRI hashes and opens a PRdevbox.json: Devbox configuration for reproducible development environments.gitignore: added Nix build result symlinksREADME.md: added Nix installation subsection
Tested locally with nix flake check --no-build, nix build .#brave, and nix run .#brave -- --version (reports Brave Browser 150.1.92.134) on x86_64-darwin.
Activity