Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Nix development flake #330

Merged
merged 1 commit into from
Oct 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake --impure
57 changes: 57 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: Nix

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions: read-all

jobs:
nix-bazel:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Mount Nix cache
uses: actions/cache@v3.3.2
with:
key: ${{ runner.os }}-nix
path: ~/nix
- name: Mount bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: ${{ runner.os }}-bazel-nix
- name: Invoke Bazel build in Nix shell
run: >
nix --store ~/nix develop --impure --command
bash -c "bazel test ..."
nix-cargo:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
with:
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Mount Nix cache
uses: actions/cache@v3.3.2
with:
key: ${{ runner.os }}-nix
path: ~/nix
- name: Invoke Cargo build in Nix shell
run: >
nix --store ~/nix develop --impure --command
bash -c "cargo test --all"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ target/
terraform.tfstate*
.update_scheduler_ips.zip
__pycache__
.devenv/
.direnv/
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ Should you wish to work on an issue, please claim it first by commenting on
the GitHub issue that you want to work on it. This is to prevent duplicated
efforts from contributors on the same issue.

## Nix development flake

You can use the Nix development flake to automatically set up Bazel, Cargo and
various Cloud CLIs for you:

1. Install the [nix package manger](https://nixos.org/download.html) and enable
[flakes](https://nixos.wiki/wiki/Flakes).
2. Optionally, install [direnv](https://direnv.net/docs/installation.html) and
hook it into your shell.
3. We currently don't ship a C++ toolchain as part of the flake. Make sure to
install a recent version of Clang.

## Pull Request Checklist

- Branch from the main branch and, if needed, rebase to the current main
Expand Down