From 08224d0cda2374648cfe4e8400f5f6643be06751 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 6 Mar 2023 10:06:40 -0500 Subject: feat(infra): add pre-commit hooks and devshell --- flake.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index eebf6e8..b8b5c78 100644 --- a/flake.nix +++ b/flake.nix @@ -5,12 +5,19 @@ url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; }; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "utils"; + }; }; outputs = { + self, nixpkgs, utils, naersk, + pre-commit-hooks, ... }: let supportedSystsems = with utils.lib.system; [ @@ -32,7 +39,27 @@ utils.lib.eachSystem supportedSystsems (system: let pkgs = import nixpkgs {inherit system;}; in { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + # formatting is taken care of by gh actions :) + deadnix.enable = true; + markdownlint.enable = true; + }; + }; + }; + + devShells.default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + packages = with pkgs; [ + nodePackages.markdownlint-cli + deadnix + ]; + }; + formatter = pkgs.alejandra; + packages = let p = packageSet pkgs; in -- cgit v1.2.3