diff --git a/.gitignore b/.gitignore index f779222..6319dc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ hardware-configuration.nix noah-password .direnv/ +.pre-commit-config.yaml diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..ff58839 --- /dev/null +++ b/default.nix @@ -0,0 +1,14 @@ +let + nix-pre-commit-hooks = import (builtins.fetchTarball "https://github.com/cachix/pre-commit-hooks.nix/tarball/master"); +in +{ + # Configured with the module options defined in `modules/pre-commit.nix`: + pre-commit-check = nix-pre-commit-hooks.run { + src = ./.; + # If your hooks are intrusive, avoid running on each commit with a default_states like this: + # default_stages = ["manual" "push"]; + hooks = { + nixpkgs-fmt.enable = true; + }; + }; +} diff --git a/shell.nix b/shell.nix index 4881215..45a493b 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,7 @@ { pkgs ? import { } }: pkgs.mkShell { packages = with pkgs; [ nil lua-language-server nixpkgs-fmt ]; + shellHook = '' + ${(import ./default.nix).pre-commit-check.shellHook} + ''; }