Skip to content

feat: add Nix flake and Devbox support - #56932

Open
levonk wants to merge 1 commit into
brave:masterfrom
levonk:feat-nix-package-manager-install
Open

feat: add Nix flake and Devbox support#56932
levonk wants to merge 1 commit into
brave:masterfrom
levonk:feat-nix-package-manager-install

Conversation

@levonk

@levonk levonk commented Jul 6, 2026

Copy link
Copy Markdown

What

Adds a flake.nix so the project can be installed and run directly from GitHub at the latest stable release:

nix run github:brave/brave-browser
nix profile install github:brave/brave-browser

The flake tracks the default branch and is auto-bumped to the latest stable release by a daily workflow, so github:brave/brave-browser always serves the current release.

Adds a devbox.json for reproducible development environments:

devbox shell
devbox run build

Why

The project publishes prebuilt release artifacts and nixpkgs already packages Brave via make-brave.nix, but there is no repo-owned flake. A repo-owned flake lets nix run github:brave/brave-browser track upstream releases directly (the nixpkgs package lags behind by days/weeks). For users who already have Nix installed, a flake provides:

  • One-command install / runnix run github:brave/brave-browser with no clone or manual build steps.
  • Pure / Hermetic builds — every input (the prebuilt binary, glibc/libiconv) 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. No "works on my machine."
  • Idempotent installs — running nix profile install twice is a no-op.
  • Rollback-ablenix profile rollback restores the previous profile generation instantly.
  • Cross-platform — same invocation on macOS (Apple Silicon & Intel) and Linux. The flake handles platform-specific linking.
  • Atomic upgrades / downgrades — profiles are switched atomically. No half-upgraded state.
  • Clean uninstallnix profile remove leaves no residue.

Changes

  • flake.nix: Nix flake wrapping the prebuilt release binary as packages.<system>.default and apps.<system>.default. Reuses nixpkgs brave packaging via overrideAttrs (swapping in upstream version + per-platform SRI hashes) to avoid duplicating ~150 lines of patchelf/wrapGApps/desktop-fixup logic.
  • flake.lock: pinned nixpkgs-unstable input.
  • .github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumps version + per-platform sha256 hashes and opens a PR when flake.nix falls behind the latest stable release.
  • devbox.json: Devbox configuration for reproducible development environments.
  • .gitignore: added Nix build result symlinks (/result, /result-*).
  • README.md: added Nix installation subsection under Downloads.

Testing

Verified locally:

nix flake check --no-build
nix build .#brave
nix run .#brave -- --version

Builds and runs successfully on x86_64-darwin (reports Brave Browser 150.1.92.134).

Notes

  • The flake wraps the prebuilt release binary rather than building from source, so it stays in sync with releases and avoids a full Chromium toolchain in the closure. Building from source is a separate concern that lives in brave-core.
  • The flake reuses nixpkgs' brave packaging (pkgs.brave.overrideAttrs) rather than vendoring make-brave.nix. This means the patchelf/wrapGAppsHook3/desktop-file-fixup/icon-symlink/OutdatedBuildDetector-disable logic is maintained upstream in nixpkgs, and this repo only maintains version + 4 SRI hashes.
  • Tag-pinning (github:brave/brave-browser/vX.Y.Z) is not supported — release tags are cut before the bump workflow updates flake.nix. Use github:brave/brave-browser (tracks default branch) or pin to a commit SHA.
  • The lag-check workflow guards on github.repository == 'brave/brave-browser' so it only runs upstream, not on forks.
  • No breaking changes to existing build paths — additive only.

Related

Resolves #56931

@levonk
levonk requested a review from a team as a code owner July 6, 2026 20:06
Adds a flake.nix wrapping the prebuilt release binaries (the same .deb/.zip
artifacts nixpkgs brave uses) so the browser can be installed and run directly
from GitHub:

  nix run github:brave/brave-browser
  nix profile install github:brave/brave-browser

The flake reuses nixpkgs' brave packaging via overrideAttrs (swapping in
upstream version + per-platform SRI hashes), avoiding ~150 lines of duplicated
patchelf/wrapGApps/desktop-fixup logic. A scheduled lag-check workflow
auto-bumps version + hashes and opens a PR when flake.nix falls behind the
latest stable release.

Supported platforms: x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@levonk
levonk force-pushed the feat-nix-package-manager-install branch from 90d76b0 to 3e6a8b5 Compare July 6, 2026 20:09
@Maybe778

Copy link
Copy Markdown

What

Adds a flake.nix so the project can be installed and run directly from GitHub at the latest stable release:

nix run github:brave/brave-browser
nix profile install github:brave/brave-browser

The flake tracks the default branch and is auto-bumped to the latest stable release by a daily workflow, so github:brave/brave-browser always serves the current release.

Adds a devbox.json for reproducible development environments:

devbox shell
devbox run build

Why

The project publishes prebuilt release artifacts and nixpkgs already packages Brave via make-brave.nix, but there is no repo-owned flake. A repo-owned flake lets nix run github:brave/brave-browser track upstream releases directly (the nixpkgs package lags behind by days/weeks). For users who already have Nix installed, a flake provides:

  • One-command install / runnix run github:brave/brave-browser with no clone or manual build steps.
  • Pure / Hermetic builds — every input (the prebuilt binary, glibc/libiconv) 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. No "works on my machine."
  • Idempotent installs — running nix profile install twice is a no-op.
  • Rollback-ablenix profile rollback restores the previous profile generation instantly.
  • Cross-platform — same invocation on macOS (Apple Silicon & Intel) and Linux. The flake handles platform-specific linking.
  • Atomic upgrades / downgrades — profiles are switched atomically. No half-upgraded state.
  • Clean uninstallnix profile remove leaves no residue.

Changes

  • flake.nix: Nix flake wrapping the prebuilt release binary as packages.<system>.default and apps.<system>.default. Reuses nixpkgs brave packaging via overrideAttrs (swapping in upstream version + per-platform SRI hashes) to avoid duplicating ~150 lines of patchelf/wrapGApps/desktop-fixup logic.
  • flake.lock: pinned nixpkgs-unstable input.
  • .github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumps version + per-platform sha256 hashes and opens a PR when flake.nix falls behind the latest stable release.
  • devbox.json: Devbox configuration for reproducible development environments.
  • .gitignore: added Nix build result symlinks (/result, /result-*).
  • README.md: added Nix installation subsection under Downloads.

Testing

Verified locally:

nix flake check --no-build
nix build .#brave
nix run .#brave -- --version

Builds and runs successfully on x86_64-darwin (reports Brave Browser 150.1.92.134).

Notes

  • The flake wraps the prebuilt release binary rather than building from source, so it stays in sync with releases and avoids a full Chromium toolchain in the closure. Building from source is a separate concern that lives in brave-core.
  • The flake reuses nixpkgs' brave packaging (pkgs.brave.overrideAttrs) rather than vendoring make-brave.nix. This means the patchelf/wrapGAppsHook3/desktop-file-fixup/icon-symlink/OutdatedBuildDetector-disable logic is maintained upstream in nixpkgs, and this repo only maintains version + 4 SRI hashes.
  • Tag-pinning (github:brave/brave-browser/vX.Y.Z) is not supported — release tags are cut before the bump workflow updates flake.nix. Use github:brave/brave-browser (tracks default branch) or pin to a commit SHA.
  • The lag-check workflow guards on github.repository == 'brave/brave-browser' so it only runs upstream, not on forks.
  • No breaking changes to existing build paths — additive only.

Related

Resolves #56931

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add Nix flake support for one-command installation

3 participants