cisagov / skeleton-generic

A generic skeleton project for quickly getting a new cisagov project started.
Creative Commons Zero v1.0 Universal
14 stars 11 forks source link

Add nixfmt pre-commit hook #143

Closed jasonodoom closed 1 year ago

jasonodoom commented 1 year ago

๐Ÿ—ฃ Description

This PR includes additions to our pre-commit config to make use of nixfmt.

๐Ÿ’ญ Motivation and context

As mentioned in the Add nix flake PR which initiated the creation of the current in order to implement the nixfmt pre-commit hook.

Validating both our workflows and any custom Actions we use is a useful addition to our pre-commit configuration.

๐Ÿงช Testing

โœ… Pre-approval checklist

jasonodoom commented 1 year ago

LGTM!

Though should we be concerned that https://github.com/nix-community/nixpkgs-fmt hasn't had a new release in over a year (June 2022)?

It should be fine. The dependencies are in Nix and we would also just need to worry about adding Rust into our env. But I can add the latest hash as the rev if you prefer?

dav3r commented 1 year ago

Though should we be concerned that https://github.com/nix-community/nixpkgs-fmt hasn't had a new release in over a year (June 2022)?

It should be fine. The dependencies are in Nix and we would also just need to worry about adding Rust into our env. But I can add the latest hash as the rev if you prefer?

I'm not following - what does Rust have to do with this adding this pre-commit hook?

mcdonnnj commented 1 year ago

LGTM! Though should we be concerned that https://github.com/nix-community/nixpkgs-fmt hasn't had a new release in over a year (June 2022)?

It should be fine. The dependencies are in Nix and we would also just need to worry about adding Rust into our env. But I can add the latest hash as the rev if you prefer?

Just a note here: pre-commit does not care about the Nix Flake stuff. The repository is set up as a Rust pre-commit hook and so pre-commit will bootstrap Rust if it is not available but will otherwise install the repository using Cargo. Please see the documentation for further reading.