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

bazel: make work on nixos ❇️ #51154

Merged
merged 3 commits into from
Apr 28, 2023
Merged

bazel: make work on nixos ❇️ #51154

merged 3 commits into from
Apr 28, 2023

Conversation

Strum355
Copy link
Contributor

@Strum355 Strum355 commented Apr 26, 2023

Some sprinkling of special sauce for the NixOS (and nix shell) users in the house. Much care has been taken so that there should be no interference with anyone running bazel on a non-nixos machine, and that it also works as (mostly) expected for nix shell users on macos.

Test plan

Ran main dry-run, all green, so it shouldnt interfere with anyone on a non-nixos machine

@cla-bot cla-bot bot added the cla-signed label Apr 26, 2023
@Strum355 Strum355 force-pushed the nsc/bazel-on-nixos branch 2 times, most recently from 877f1ae to b809970 Compare April 26, 2023 17:01
@Strum355 Strum355 self-assigned this Apr 27, 2023
@Strum355 Strum355 added nix For Nix(OS) related issues/PRs bazel labels Apr 27, 2023
@Strum355 Strum355 marked this pull request as ready for review April 27, 2023 16:48
Copy link
Contributor

@jhchabran jhchabran left a comment

Choose a reason for hiding this comment

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

Approving, because the little suggestion I made is pretty straightforward and it would be okay to merge as is any way, as it's mostly cosmetic :)

@@ -74,19 +74,50 @@ http_archive(
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.19.0/rules_rust-v0.19.0.tar.gz"],
)

http_archive(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this into dev/nix.bzl ?

You can basically take all of this code, and wrap it under a macro:

# dev/nix.bzl 
def nix_deps(): 
  http_archive(...) 
# WORKSPACE
load("//dev:nix.bzl", "nix_deps") 
nix_deps() 

This way we avoid lengthening this file further 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done as best I could here, it seems like rules_nixpkgs_dependencies must be called before any of the other symbols are loaded, so some stuff remains in WORKSPACE

@Strum355 Strum355 force-pushed the nsc/bazel-on-nixos branch from b809970 to c92076f Compare April 27, 2023 23:52
@Strum355
Copy link
Contributor Author

Will need to rebase this now that https://github.com/sourcegraph/sourcegraph/pull/49884 landed, job for tomorrow

@Strum355 Strum355 force-pushed the nsc/bazel-on-nixos branch from c92076f to 916f03f Compare April 28, 2023 20:00
@Strum355 Strum355 enabled auto-merge (squash) April 28, 2023 20:05
@Strum355 Strum355 merged commit 884dcbe into main Apr 28, 2023
@Strum355 Strum355 deleted the nsc/bazel-on-nixos branch April 28, 2023 20:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bazel cla-signed nix For Nix(OS) related issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants