Skip to content

Better documentation of "alongside" bazelrc location #355

@philandstuff

Description

@philandstuff

I'm trying to package bazel for nixpkgs (see NixOS/nixpkgs#9008 if you're interested). One issue I'm encountering is how set up a base_workspace and make it available for all users.

As described on the blog, the compile.sh script will create a .bazelrc in $HOME to link to the base_workspace it provides. I want to do something similar, but the package should work even when deployed to another machine so $HOME/.bazelrc won't work for me. This feels like a use-case for a master bazelrc, of which there are three possibilities: "next to the binary, in the workspace at tools/bazel.rc or system-wide at /etc/bazel.bazelrc". For my purposes, the "next to the binary" option seems the best fit, to keep it with the other packaged files in the nix store.

However, the documentation leaves out some information about how to do this. What should the file be called? .bazelrc, bazel.bazelrc, or bazel.rc, which are all options used elsewhere? And which directory should it be in? To me, "next to the binary" might mean any of these:

  • /path/to/bazel-pkg/bin - literally the same directory as the bazel binary, unusually for a config file
  • /path/to/bazel-pkg - in the bazel package, though not in the bin directory as config doesn't normally go in there
  • /path/to/bazel-pkg/etc - in the bazel package, in the directory where config files normally go

(I'm sure I'm doing something wrong because I couldn't get any of these options to work.)

If the documentation gave a specific example, saying where the bazel binary is and where the "alongside" rc file is in relation to it, that would answer all of my questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions