Skip to content

Commit

Permalink
flake.nix: add pre-commit-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed May 5, 2024
1 parent bbdd5e3 commit 3c71afb
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 23 deletions.
167 changes: 146 additions & 21 deletions flake.lock

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

14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
url = "github:nix-community/NUR";
};

pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";

# Rust overlay
rust-overlay = {
url = "github:oxalica/rust-overlay";
Expand Down Expand Up @@ -197,6 +199,18 @@
_system: deploy-lib: deploy-lib.deployChecks inputs.self.deploy
) deploy-rs.lib;

outputs-builder = channels: {
checks.pre-commit-check = inputs.pre-commit-hooks-nix.lib.${channels.nixpkgs.system}.run {
src = ./.;
hooks = {
deadnix.enable = true;
nixfmt.enable = true;
prettier.enable = true;
statix.enable = true;
};
};
};

formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixfmt-rfc-style;
};
Expand Down
5 changes: 3 additions & 2 deletions shells/default/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
self:
{
inputs,
mkShell,
Expand Down Expand Up @@ -28,8 +29,8 @@ mkShell {
];

shellHook = ''
echo 🔨 Welcome to khanelinix
${self.checks.${system}.pre-commit-check.shellHook}
echo 🔨 Welcome to khanelinix
'';
Expand Down

0 comments on commit 3c71afb

Please sign in to comment.