the-algorithm icon indicating copy to clipboard operation
the-algorithm copied to clipboard

❄️ Add Nix flake and pre-commit hooks

Open aaronmondal opened this issue 2 years ago • 6 comments

Setting up the different tools for development can be hard for new contributors. This commit adds a Nix flake that provides a reproducible development environment which is easy to set up and ensures consistent code style across all subprojects.

The initial flake contains git, pre-commit, which and bazelisk wrapped as a bazel executable. Dependencies like Rust, Scala etc may be added in the packages attribute in the future.

The current pre-commit configuration is a no-op. Future commits may enable the currently disabled parts of pre-commit-hooks.nix for a gradual transition.

Supports (x86_64|aarch64) (Linux|MacOS) systems.

aaronmondal avatar Mar 31 '23 22:03 aaronmondal

Good job on this PR.

ctjlewis avatar Mar 31 '23 23:03 ctjlewis

This also allows rather straightforward integration with GitHub actions. See https://github.com/eomii/rules_ll/blob/main/.github/workflows/pre-commit.yml for an example that uses the same logic as implemented in this flake to run the hooks from a repo-local GitHub action cache.

aaronmondal avatar Mar 31 '23 23:03 aaronmondal

cc @jdm-twtr

ctjlewis avatar Mar 31 '23 23:03 ctjlewis

Re-signed without additional changes to trigger CLA check.

aaronmondal avatar Mar 31 '23 23:03 aaronmondal

Correctly forward command line arguments to bazelisk.

aaronmondal avatar Apr 01 '23 01:04 aaronmondal

Nice.

saifookhan avatar Apr 03 '23 14:04 saifookhan