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

nix: patch bazel_7 with hardcoded bin paths #59359

Merged
merged 1 commit into from
Jan 16, 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
52 changes: 52 additions & 0 deletions dev/nix/bazel.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{ nixpkgs
, pkgs
, bazel_7
, lib
, substituteAll
, bash
, coreutils
, diffutils
, file
, findutils
, gawk
, gnugrep
, gnupatch
, gnused
, gnutar
, gzip
, python3
, 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;
})
];
});
}
13 changes: 8 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.nodejs-20_x ]; };
pkgs = nixpkgs.legacyPackages.${system};
pkgsShell = import nixpkgs { inherit system; overlays = with self.overlays; [ nodejs-20_x bazel_7 ]; };
pkgsBins = nixpkgs-stable.legacyPackages.${system};
pkgs' = import nixpkgs { inherit system; overlays = builtins.attrValues self.overlays; };
pkgsAll = import nixpkgs { inherit system; overlays = builtins.attrValues self.overlays; };
pkgsX = xcompileTargets.${system} or null;
in
{
legacyPackages = pkgs';
legacyPackages = pkgsAll;

packages = xcompilify { inherit pkgsX; pkgs = pkgsBins; }
(p: {
Expand All @@ -35,12 +36,13 @@
}) // {
# 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;
};

# We use pkgs (not pkgs') intentionally to avoid doing extra work of
# We use pkgsShell (not pkgsAll) intentionally to avoid doing extra work of
# building static comby/universal-ctags in our development
# environments.
devShells.default = pkgs.callPackage ./shell.nix { };
devShells.default = pkgsShell.callPackage ./shell.nix { };

formatter = pkgs.nixpkgs-fmt;
}) // {
Expand All @@ -49,6 +51,7 @@
comby = final: prev: { comby = self.packages.${prev.system}.comby; };
nodejs-20_x = final: prev: { nodejs-20_x = self.packages.${prev.system}.nodejs-20_x; };
p4-fusion = final: prev: { p4-fusion = self.packages.${prev.system}.p4-fusion; };
bazel_7 = final: prev: { bazel_7 = self.packages.${prev.system}.bazel_7; };
};
};
}
Loading