mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:11:48 +00:00
bazel (and its community of rules) is a bit of a mess when it comes to passing around env values, including $PATH, resulting in some actions not receiving the $PATH value set via `--action_path=PATH=...` that we rely on. Bazel 6 in nixpkgs had [the following patch](https://sourcegraph.com/github.com/NixOS/nixpkgs/-/blob/pkgs/development/tools/build-managers/bazel/bazel_6/actions_path.patch) that hardcodes a set of packages to include in that case, which is currently missing from Bazel 7 in nixpkgs, so we (temporarily, hopefully) reintroduce that patch locally. See: https://github.com/NixOS/nixpkgs/pull/262152#issuecomment-1879053113 and https://github.com/NixOS/nixpkgs/issues/94222 for some reading I plan to move more bazel stuff out of shell.nix perhaps, into bazel.nix, as its a tad messy all-in-one ## Test plan `bazel build //client/web/dist` is successful
58 lines
2.5 KiB
Nix
58 lines
2.5 KiB
Nix
{
|
|
description = "The Sourcegraph developer environment & packages Nix Flake";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
|
# 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 }:
|
|
let
|
|
xcompileTargets = with nixpkgs-stable.lib.systems.examples; {
|
|
"aarch64-darwin" = nixpkgs-stable.legacyPackages.aarch64-darwin.pkgsx86_64Darwin;
|
|
"x86_64-darwin" = import nixpkgs-stable { system = "x86_64-darwin"; crossSystem = aarch64-darwin; };
|
|
};
|
|
inherit (import ./dev/nix/util.nix { inherit (nixpkgs) lib; }) xcompilify;
|
|
in
|
|
flake-utils.lib.eachDefaultSystem
|
|
(system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
pkgsShell = import nixpkgs { inherit system; overlays = with self.overlays; [ nodejs-20_x bazel_7 ]; };
|
|
pkgsBins = nixpkgs-stable.legacyPackages.${system};
|
|
pkgsAll = import nixpkgs { inherit system; overlays = builtins.attrValues self.overlays; };
|
|
pkgsX = xcompileTargets.${system} or null;
|
|
in
|
|
{
|
|
legacyPackages = pkgsAll;
|
|
|
|
packages = xcompilify { inherit pkgsX; pkgs = pkgsBins; }
|
|
(p: {
|
|
ctags = p.callPackage ./dev/nix/ctags.nix { };
|
|
comby = p.callPackage ./dev/nix/comby.nix { };
|
|
p4-fusion = p.callPackage ./dev/nix/p4-fusion.nix { };
|
|
}) // {
|
|
# 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 pkgsShell (not pkgsAll) intentionally to avoid doing extra work of
|
|
# building static comby/universal-ctags in our development
|
|
# environments.
|
|
devShells.default = pkgsShell.callPackage ./shell.nix { };
|
|
|
|
formatter = pkgs.nixpkgs-fmt;
|
|
}) // {
|
|
overlays = {
|
|
ctags = final: prev: { universal-ctags = self.packages.${prev.system}.ctags; };
|
|
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; };
|
|
};
|
|
};
|
|
}
|