mirror of
https://github.com/callumio/nish.git
synced 2025-12-18 03:59:19 +00:00
chore: setup treefmt and pre-commit
This commit is contained in:
parent
cae2526833
commit
1c5a478ad4
3 changed files with 107 additions and 0 deletions
29
flake.nix
29
flake.nix
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
|
|
@ -28,11 +33,16 @@
|
|||
} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit self inputs;} {
|
||||
systems = import inputs.systems;
|
||||
imports = [
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
perSystem = {
|
||||
pkgs,
|
||||
inputs',
|
||||
self',
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
rustToolchain = inputs'.fenix.packages.fromToolchainFile {
|
||||
|
|
@ -74,8 +84,27 @@
|
|||
|
||||
devShells.default = craneLib.devShell {
|
||||
inherit (self') checks;
|
||||
inputsFrom = [config.pre-commit.devShell config.treefmt.build.devShell];
|
||||
packages = [];
|
||||
};
|
||||
|
||||
pre-commit = {
|
||||
check.enable = false;
|
||||
settings.hooks = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
treefmt.config = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue