feat: setup pre-commit-hooks

This commit is contained in:
Felix Schröter 2020-09-24 12:35:45 +02:00
parent 56fd0a749e
commit 5e0b72ca74
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58
4 changed files with 166 additions and 11 deletions

View file

@ -1,11 +1,17 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.home-manager.url = "github:nix-community/home-manager/master";
inputs.nur.url = "github:nix-community/NUR/master";
outputs = { self, nixpkgs, home-manager, nur }:
inputs.pre-commit-hooks.url =
# "github:Myhlamaeus/pre-commit-hooks.nix/feat/flake";
"github:Myhlamaeus/pre-commit-hooks.nix/8d48a4cd434a6a6cc8f2603b50d2c0b2981a7c55";
outputs = { self, nixpkgs, flake-utils, home-manager, nur, pre-commit-hooks }:
let
systemModule = { hostName, hardwareConfig, config }:
({ pkgs, ... }: {
@ -50,5 +56,14 @@
homeManagerModules.git = import ./home/modules/git.nix;
};
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pre-commit-check = pre-commit-hooks.defaultPackage.${system} {
src = ./.;
hooks = { nixfmt.enable = true; };
};
in {
devShell = pkgs.mkShell { inherit (pre-commit-check) shellHook; };
});
}