add pre-commit shellHook

This commit is contained in:
DavHau 2022-03-07 18:25:38 +07:00
parent 667d639c94
commit e0c433078b
2 changed files with 4 additions and 5 deletions

View File

@ -255,10 +255,8 @@
++ lib.optionals pkgs.stdenv.isLinux [pkgs.cntr];
shellHook =
# TODO: pre-commit shellHook disabled until this is solved:
# https://github.com/cachix/pre-commit-hooks.nix/issues/140
# self.checks.${system}.pre-commit-check.shellHook
''
self.checks.${system}.pre-commit-check.shellHook
+ ''
export NIX_PATH=nixpkgs=${nixpkgs}
export d2nExternalDir=${externalDirFor."${system}"}
export dream2nixWithExternals=${dream2nixFor."${system}".dream2nixWithExternals}
@ -296,7 +294,7 @@
entry = l.toString (pkgs.writeScript "treefmt" ''
#!${pkgs.bash}/bin/bash
export PATH="$PATH:${alejandra.defaultPackage.${system}}/bin"
${pkgs.treefmt}/bin/treefmt --fail-on-change
${pkgs.treefmt}/bin/treefmt --clear-cache --fail-on-change
'');
};
};

1
shell.nix Normal file
View File

@ -0,0 +1 @@
(builtins.getFlake (builtins.toString ./.)).devShell.x86_64-linux