From c83cefd8fb348a40fbe8ae79da460dbb403fa740 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Wed, 21 Aug 2024 16:56:50 +0200 Subject: [PATCH] stylix: add deadnix and statix pre-commit hooks Add the deadnix and statix pre-commit hooks used in the Lint GitHub workflow. Link: https://github.com/danth/stylix/pull/519 --- flake.lock | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 19 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/flake.lock b/flake.lock index a8ab67b5..b05b9fdd 100644 --- a/flake.lock +++ b/flake.lock @@ -166,6 +166,55 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1725513492, + "narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "7570de7b9b504cfe92025dd1be797bf546f66528", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gnome-shell": { "flake": false, "locked": { @@ -230,6 +279,7 @@ "base16-vim": "base16-vim", "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index a407bb65..36eed4ee 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,16 @@ url = "github:numtide/flake-utils"; }; + git-hooks = { + inputs = { + flake-compat.follows = "flake-compat"; + nixpkgs-stable.follows = "git-hooks/nixpkgs"; + nixpkgs.follows = "nixpkgs"; + }; + + url = "github:cachix/git-hooks.nix"; + }; + gnome-shell = { flake = false; @@ -70,6 +80,15 @@ inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.${system}; in { + checks.git-hooks = inputs.git-hooks.lib.${system}.run { + hooks = { + deadnix.enable = true; + statix.enable = true; + }; + + src = ./.; + }; + devShells.default = pkgs.mkShell { packages = [ inputs.home-manager.packages.${system}.default ]; };