Conversation
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>
90d76b0 to
3e6a8b5
Compare
|
|
Checking with others on our team who have used nix, but we're not certain what this is doing. In any case, I don't think this is where we'd land it if we added support for nix installations. Is there a human we can discuss this with to understand better cause this seems like AI generated PRs and issues? |
|
Sure, what can I answer? You can see my workflow too if you're interested in the details, I try to automate most of my repeat work and I prefer nix packages from the source repo. The detailed skill body that I use to do this quickly is here: It's a lot, but that's because it's hands off with pretty much any agent end-to-end. since it's a pretty common task for me. |
|
Hey, I'm just another Nix(OS) user. As I see it, the value of this PR is that nixpkgs won't have to bump the version, and the flake would live in the official repo. I don't use Devbox, personally. Myself, I just copied the brave dir from nixpkgs, stripping unneeded CPU arches, and update the hashes daily. If maintainers are interested in adding Nix support, I'd be happy to discuss to the best of my knowledge or invite someone more experienced from the community to the discussion. Thanks. |
|
Devbox is pretty low value here since the repo is a releases repo and there is no build step, but normally it's a great way to get an isolated build environment with all the necessary tooling at the versions in the lockfile, with any build targets that can call through to the projects build tool. Basically unify node, rust, C++, Go, etc... build tooling with a wrapper layer. @Lippiece if you have any feedback for me too, I'd love to hear it. Thanks for jumping in! |
|
I’ve not used nix or know why nixpkg is an advantage or disadvantage versus your approach. My experience with Linux is primarily Debian based. Could you provide some details or docs for me to at least get context for this? also, what’s the advantage to it living in an official repository? most of our CI packaging exists in separate services not ran through GH actions. Additionally, this repository isn’t where most development occurs and instead has all been migrated to brave-core. So, I’m trying to understand the goal here first so that we can figure out where the right place for it might be and also determine how we’d maintain it. We’d also need to sort through whether it’s something we have people on hand to continue to officially maintain it going forward. I definitely wouldn’t be given I’ve not used nix, but I’m the one who came across this so trying to figure out what should be done with it and who on our team might be able interested in helping maintain it. |
|
Thanks for being open to this, and all the work the Brave contributors have made. Nix vs Debian (apt), in one paragraph apt and nix are both package managers, but they make opposite tradeoffs. apt mutates a single shared /usr — when you upgrade libfoo, every app that depended on the old libfoo now sees the new one, and if something breaks you reinstall or hunt through apt logs. nix puts every package (and every version of every dependency) in its own isolated path under /nix/store/-name, so two versions of the same If it helps, I can point you at the Nix manual's intro section: https://nixos.org/manual/nix/stable/introduction.html — it's a ~10 minute read and explains the model without requiring you to install Why a repo-owned flake vs. relying on nixpkgs nixpkgs already packages Brave, but it's maintained by a third-party volunteer and lags upstream releases by days to weeks. A flake living in brave/brave-browser (or wherever Brave owns it) means: • The release team controls the cadence — the bump workflow I included auto-bumps version + hashes on a schedule, so On where it should live (brave-browser vs brave-core) Worth flagging — I opened it here because this is where the release artifacts are published and where the README's "Downloads" section lives, but you're right that development has moved to brave-core. The flake wraps the prebuilt release binary, not a build-from-source path, so it doesn't need to live next to the source. It just needs to live wherever Brave wants the canonical "install Brave via Nix" On maintenance going forward Totally fair concern. The honest answer: the bump workflow is designed so that no human has to touch it day-to-day — it opens its own PR when Brave releases. The only ongoing maintenance is reviewing that PR (which is just a version string + 4 hashes) and occasionally updating flake.lock when nixpkgs changes something. If nobody on the team wants to own it, that's a reasonable reason to decline — I'd |
|
Appreciate the context for this. Let me discuss with others and figure out what makes sense here. I see the benefit in not having release lag here. Also makes sense why the starting point for the PR was in this repo now rather than brave-core. I think the biggest issue is going to be us figuring out who can maintain it on our end and how we'll fit it in with our release process. At this point, I don't have great answers for it so I'd recommend keeping the nixpkg community maintained version ongoing for now and we can let this PR sit for a bit while we figure out how to handle it. |
|
Concerning maintenance: the only expected required maintenance would be based on significant path/filenames changes, and even that could be mitigated by adjusting the flake by Nix volunteers if that becomes a burden. Also, the Python script could be replaced by nixpkgs#nix-update. For nightly and nix files from nixpkgs repo, I run this: |
|
Thanks for the For this particular flake shape, there's a reason why I prefer the custom update script. The flake uses a per-platform assets attrset with four entries (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin), each with its own file and sha256. nix-update targets a single-derivation That said, the suggestion did surface a real gap I've now filled. I added an For full disclosure on the Please do let me know if I'm missing anything. |
What
Adds a
flake.nixso the project can be installed and run directly from GitHub at the latest stable release:The flake tracks the default branch and is auto-bumped to the latest stable release by a daily workflow, so
github:brave/brave-browseralways serves the current release.Adds a
devbox.jsonfor reproducible development environments: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 letsnix run github:brave/brave-browsertrack upstream releases directly (the nixpkgs package lags behind by days/weeks). For users who already have Nix installed, a flake provides:nix run github:brave/brave-browserwith no clone or manual build steps.flake.lock. If it builds today, it builds in ten years.nix profile installtwice is a no-op.nix profile rollbackrestores the previous profile generation instantly.nix profile removeleaves no residue.Changes
flake.nix: Nix flake wrapping the prebuilt release binary aspackages.<system>.defaultandapps.<system>.default. Reuses nixpkgsbravepackaging viaoverrideAttrs(swapping in upstream version + per-platform SRI hashes) to avoid duplicating ~150 lines of patchelf/wrapGApps/desktop-fixup logic.flake.lock: pinnednixpkgs-unstableinput..github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumpsversion+ per-platformsha256hashes and opens a PR whenflake.nixfalls 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:
Builds and runs successfully on
x86_64-darwin(reportsBrave Browser 150.1.92.134).Notes
brave-core.bravepackaging (pkgs.brave.overrideAttrs) rather than vendoringmake-brave.nix. This means the patchelf/wrapGAppsHook3/desktop-file-fixup/icon-symlink/OutdatedBuildDetector-disable logic is maintained upstream in nixpkgs, and this repo only maintainsversion+ 4 SRI hashes.github:brave/brave-browser/vX.Y.Z) is not supported — release tags are cut before the bump workflow updatesflake.nix. Usegithub:brave/brave-browser(tracks default branch) or pin to a commit SHA.github.repository == 'brave/brave-browser'so it only runs upstream, not on forks.Related
Resolves #56931