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

nix: bump to bazel 7.1 #61326

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=" ];
};
Comment on lines +4 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my amd64 linux machine it still seemed to build bazel-7.1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did it prompt you to trust this substituter? Can you figure out what the store path is and I can check if it matches what Id expect? nix path-info .#bazel_7 I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I answered yes but just noticed this warning:

warning: ignoring untrusted substituter 'https://sourcegraph-noah.cachix.org', you are not a trusted user.
❯ nix path-info .#bazel_7
warning: ignoring untrusted substituter 'https://sourcegraph-noah.cachix.org', you are not a trusted user.
Run `man nix.conf` for more information on the `substituters` configuration option.
evaluating derivation 'git+file:///home/keegan/src/github.com/sourcegraph/sourcegraph#bazel_7'/nix/store/n63v6d0m4p32n7zl3aqvmdnzq3m0ajm4-bazel-7.1.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That path exists, so its a case of you needing to add your user to the list of trusted users in nix.conf, then itll work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the warning without making my user effectively root :) keegancsmith/dotfiles@8936f44

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just finished reading about that as well, wew it is confusing!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoyingly, the CLI prompts for adding the substituter as trusted if it isnt already, but only if youre a trusted user I presume, which makes the experience a bit better than you having to edit nix.conf :/


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
Loading