File tree Expand file tree Collapse file tree 4 files changed +89
-1
lines changed
Expand file tree Collapse file tree 4 files changed +89
-1
lines changed Original file line number Diff line number Diff line change 1+ # Nix devshells cached by direnv
12/.direnv /
23
34# The directory Mix will write compiled artifacts to.
@@ -26,3 +27,6 @@ memorable-*.tar
2627
2728# Memorable development databases
2829/db /
30+
31+ # git-hooks.nix generated configuration
32+ /.pre-commit-config.yaml
Original file line number Diff line number Diff line change 55 nixpkgs . url = "github:nixos/nixpkgs/nixpkgs-unstable" ;
66 flake-utils . url = "github:numtide/flake-utils" ;
77 flake-compat . url = "github:edolstra/flake-compat" ;
8+
9+ git-hooks . url = "github:cachix/git-hooks.nix" ;
10+ git-hooks . inputs . nixpkgs . follows = "nixpkgs" ;
811 } ;
912
1013 outputs =
1114 {
15+ self ,
1216 nixpkgs ,
1317 flake-utils ,
18+ git-hooks ,
1419 ...
1520 } :
1621 flake-utils . lib . eachDefaultSystem (
1924 pkgs = nixpkgs . legacyPackages . ${ system } ;
2025 in
2126 {
22- devShell = import ./shell.nix { inherit pkgs ; } ;
27+ checks . pre-commit-check = git-hooks . lib . ${ system } . run {
28+ src = ./. ;
29+ hooks = {
30+ mix-format . enable = true ;
31+ nixfmt-rfc-style . enable = true ;
32+ } ;
33+ } ;
34+
35+ devShell = import ./shell.nix {
36+ inherit pkgs ;
37+ preCommitHook = self . checks . ${ system } . pre-commit-check . shellHook ;
38+ } ;
2339 }
2440 ) ;
2541}
Original file line number Diff line number Diff line change 11{
22 pkgs ? import <nixpkgs> { } ,
3+ preCommitHook ? "" ,
34} :
45
56pkgs . mkShell {
@@ -8,5 +9,12 @@ pkgs.mkShell {
89 packages = with pkgs ; [
910 elixir
1011 elixir-ls
12+
13+ nixfmt-rfc-style
14+ nil
1115 ] ;
16+
17+ shellHook = ''
18+ ${ preCommitHook }
19+ '' ;
1220}
You can’t perform that action at this time.
0 commit comments