mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 04:27:45 +00:00
chore: add a more ergonomic (and cleaner) devshell
- project a pre-commit hook for contributors - add an editorconfig
This commit is contained in:
parent
27e2435aa7
commit
f9a8373893
5 changed files with 109 additions and 3 deletions
27
flake.nix
27
flake.nix
|
@ -20,6 +20,7 @@
|
|||
treefmt.url = "github:numtide/treefmt";
|
||||
treefmt.inputs.flake-utils.follows = "flakeUtils";
|
||||
treefmt.inputs.nixpkgs.follows = "nixpkgs";
|
||||
devshell.url = "github:numtide/devshell";
|
||||
};
|
||||
outputs =
|
||||
inputs:
|
||||
|
@ -31,6 +32,7 @@
|
|||
nixpkgs = import inputs.nixpkgs { inherit system; };
|
||||
cargoToml = builtins.fromTOML ( builtins.readFile ./Cargo.toml );
|
||||
treefmt = inputs.treefmt.defaultPackage.${ system };
|
||||
devshell = inputs.devshell.legacyPackages.${ system };
|
||||
fenix = inputs.fenix.packages.${ system };
|
||||
fenixPlatform = nixpkgs.makeRustPlatform { inherit ( fenix.latest ) cargo rustc; };
|
||||
in
|
||||
|
@ -60,11 +62,16 @@
|
|||
};
|
||||
};
|
||||
devShell =
|
||||
nixpkgs.mkShell
|
||||
devshell.mkShell
|
||||
{
|
||||
imports = [ "${ devshell.extraModulesDir }/git/hooks.nix" ];
|
||||
git.hooks = {
|
||||
enable = true;
|
||||
pre-commit.text = builtins.readFile ./pre-commit.sh;
|
||||
};
|
||||
name = "alejandra";
|
||||
packages = [
|
||||
fenix.rust-analyzer
|
||||
fenix.latest.cargo
|
||||
fenix.latest.clippy
|
||||
fenix.latest.rust-src
|
||||
fenix.latest.rustc
|
||||
|
@ -75,7 +82,21 @@
|
|||
nixpkgs.nodePackages.prettier
|
||||
nixpkgs.nodePackages.prettier-plugin-toml
|
||||
nixpkgs.shfmt
|
||||
treefmt
|
||||
];
|
||||
commands = [
|
||||
{
|
||||
package = fenix.latest.cargo;
|
||||
name = "cargo";
|
||||
help = "the cargo tool";
|
||||
}
|
||||
{
|
||||
package = treefmt;
|
||||
category = "formatters";
|
||||
}
|
||||
{
|
||||
package = nixpkgs.editorconfig-checker;
|
||||
category = "formatters";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue