Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
nix: bump to bazel 7.1 (#61326)
Browse files Browse the repository at this point in the history
Using my fork with open PR: NixOS/nixpkgs#295615

Im needing 7.1 sooner than later, given its new features and this repo also using 7.1 (so all new features are fair game for it!)

Cached version is pushed to sourcegraph-noah.cachix.org, which I've added at the top here so you too can avoid building it locally 🙂 

## Test plan

Tested locally 😎
  • Loading branch information
Strum355 authored Mar 22, 2024
1 parent 0ce98cd commit 2f8990e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 36 deletions.
66 changes: 32 additions & 34 deletions dev/nix/bazel.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{ nixpkgs
, pkgs
{ pkgs
, bazel_7
, lib
, substituteAll
Expand All @@ -18,35 +17,34 @@
, unzip
, which
, zip
}: {
bazel_7 = bazel_7.overrideAttrs (oldAttrs:
let
# yoinked from https://sourcegraph.com/github.com/NixOS/nixpkgs/-/blob/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix?L77-120
defaultShellUtils = [
bash
coreutils
diffutils
file
findutils
gawk
gnugrep
gnupatch
gnused
gnutar
gzip
python3
unzip
which
zip
];
in
{
# https://github.com/NixOS/nixpkgs/pull/262152#issuecomment-1879053113
patches = (oldAttrs.patches or [ ]) ++ [
(substituteAll {
src = "${nixpkgs}/pkgs/development/tools/build-managers/bazel/bazel_6/actions_path.patch";
actionsPathPatch = lib.makeBinPath defaultShellUtils;
})
];
});
}
}:
let
# yoinked from https://sourcegraph.com/github.com/NixOS/nixpkgs/-/blob/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix?L77-120
defaultShellUtils = [
bash
coreutils
diffutils
file
findutils
gawk
gnugrep
gnupatch
gnused
gnutar
gzip
python3
unzip
which
zip
];
in
bazel_7.overrideAttrs (oldAttrs:
{
# https://github.com/NixOS/nixpkgs/pull/262152#issuecomment-1879053113
patches = (oldAttrs.patches or [ ]) ++ [
(substituteAll {
src = "${pkgs.path}/pkgs/development/tools/build-managers/bazel/bazel_6/actions_path.patch";
actionsPathPatch = lib.makeBinPath defaultShellUtils;
})
];
})
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
description = "The Sourcegraph developer environment & packages Nix Flake";

nixConfig = {
extra-substituters = [ "https://sourcegraph-noah.cachix.org" ];
extra-trusted-public-keys = [ "sourcegraph-noah.cachix.org-1:rTTKnyuUmJuGt/UAXUpdOCOXDAfaO1AYy+/jSre3XgA=" ];
};

inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
nixpkgs-bazel.url = "github:Strum355/nixpkgs/bazel-7.1.0";
# separate nixpkgs pin for more stable changes to binaries we build
nixpkgs-stable.url = "github:NixOS/nixpkgs/e78d25df6f1036b3fa76750ed4603dd9d5fe90fc";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, nixpkgs-stable, flake-utils }:
outputs = { self, nixpkgs, nixpkgs-stable, flake-utils, nixpkgs-bazel }:
let
xcompileTargets = with nixpkgs-stable.lib.systems.examples; {
"aarch64-darwin" = nixpkgs-stable.legacyPackages.aarch64-darwin.pkgsx86_64Darwin;
Expand Down Expand Up @@ -36,7 +42,7 @@
}) // {
# doesnt need the same stability as those above
nodejs-20_x = pkgs.callPackage ./dev/nix/nodejs.nix { };
inherit (pkgs.callPackage ./dev/nix/bazel.nix { inherit nixpkgs; }) bazel_7;
bazel_7 = nixpkgs-bazel.legacyPackages.${system}.callPackage ./dev/nix/bazel.nix { };
};

# We use pkgsShell (not pkgsAll) intentionally to avoid doing extra work of
Expand Down

0 comments on commit 2f8990e

Please sign in to comment.