Skip to content

Commit

Permalink
nix: Switch to pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Feb 10, 2025
1 parent 79e4386 commit 246ebe4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 48 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ dist

/assets/tailwind.css

/.vscode/spellright.dict
/.vscode/spellright.dict

/.pre-commit-config.yaml
38 changes: 17 additions & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

rust-flake.url = "github:juspay/rust-flake";
rust-flake.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.flake = false;
cachix-push.url = "github:juspay/cachix-push";

# We cache these inputs locally, and then have Omnix reference the catched inputs.
Expand Down
8 changes: 3 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ mod doc
default:
@just --list

# Auto-format the source tree
fmt:
treefmt

alias f := fmt
# Run all pre-commit hooks on all files
pca:
pre-commit run -a

# Run omnix-cli locally
watch *ARGS:
Expand Down
2 changes: 1 addition & 1 deletion nix/modules/flake-parts/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ in
name = "omnix-devshell";
meta.description = "Omnix development environment";
inputsFrom = [
config.treefmt.build.devShell
config.pre-commit.devShell
self'.devShells.rust
];
inherit (config.rust-project.crates."omnix-cli".crane.args)
Expand Down
18 changes: 0 additions & 18 deletions nix/modules/flake-parts/formating.nix

This file was deleted.

15 changes: 15 additions & 0 deletions nix/modules/flake-parts/pre-commit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{ inputs, ... }:
{
imports = [
(inputs.git-hooks + /flake-module.nix)
];

perSystem = {
pre-commit.settings = {
hooks = {
nixpkgs-fmt.enable = true;
rustfmt.enable = true;
};
};
};
}

0 comments on commit 246ebe4

Please sign in to comment.