build: git-hooks

This commit is contained in:
Marc Jakobi 2024-08-19 22:00:50 +02:00
parent afd15ca69f
commit 603878f8b7
2 changed files with 95 additions and 0 deletions

View file

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -18,6 +34,50 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723803910,
"narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba",
"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"
}
},
"luvit-meta": { "luvit-meta": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -62,9 +122,26 @@
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
} }
}, },
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"luvit-meta": "luvit-meta", "luvit-meta": "luvit-meta",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View file

@ -8,6 +8,10 @@
url = "github:Bilal2453/luvit-meta"; url = "github:Bilal2453/luvit-meta";
flake = false; flake = false;
}; };
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = inputs @ { outputs = inputs @ {
@ -15,6 +19,7 @@
nixpkgs, nixpkgs,
flake-parts, flake-parts,
luvit-meta, luvit-meta,
git-hooks,
}: }:
flake-parts.lib.mkFlake {inherit inputs;} { flake-parts.lib.mkFlake {inherit inputs;} {
systems = [ systems = [
@ -33,12 +38,25 @@
luarc = pkgs.mk-luarc-json { luarc = pkgs.mk-luarc-json {
plugins = with pkgs.vimPlugins; [telescope-nvim fidget-nvim]; plugins = with pkgs.vimPlugins; [telescope-nvim fidget-nvim];
}; };
git-hooks-check = git-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
editorconfig-checker.enable = true;
};
};
in { in {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "gen-luarc devShell";
buildInputs = self.checks.${system}.git-hooks-check.enabledPackages;
shellHook = '' shellHook = ''
ln -fs ${pkgs.luarc-to-json luarc} .luarc.json ln -fs ${pkgs.luarc-to-json luarc} .luarc.json
''; '';
}; };
checks = rec {
default = git-hooks-check;
inherit git-hooks-check;
};
}; };
flake = { flake = {
overlays.default = final: prev: let overlays.default = final: prev: let