summaryrefslogtreecommitdiff
path: root/parts/dev.nix
diff options
context:
space:
mode:
Diffstat (limited to 'parts/dev.nix')
-rw-r--r--parts/dev.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/parts/dev.nix b/parts/dev.nix
new file mode 100644
index 0000000..01c33c6
--- /dev/null
+++ b/parts/dev.nix
@@ -0,0 +1,62 @@
+{
+ inputs,
+ self,
+ ...
+}: {
+ perSystem = {
+ craneLib,
+ pkgs,
+ system,
+ src,
+ toolchain,
+ ...
+ }: {
+ checks = let
+ commonArgs = {
+ inherit src;
+ };
+
+ inherit (craneLib) cargoClippy cargoFmt;
+ in {
+ inherit (self.packages.${system}) teawiebot;
+
+ clippy = cargoClippy (commonArgs
+ // {
+ inherit (self.packages.${system}) cargoArtifacts;
+ cargoClippyExtraArgs = "--all-targets";
+ });
+
+ fmt = cargoFmt commonArgs;
+
+ pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
+ inherit src;
+ hooks = {
+ actionlint.enable = true;
+ alejandra.enable = true;
+ deadnix.enable = true;
+ nil.enable = true;
+ statix.enable = true;
+ };
+ };
+ };
+
+ devShells = let
+ inherit (pkgs) mkShell;
+ in {
+ default = mkShell {
+ inherit (self.checks.${system}.pre-commit-check) shellHook;
+ packages = with pkgs; [
+ actionlint
+ alejandra
+ deadnix
+ nil
+ statix
+
+ toolchain
+ ];
+ };
+ };
+
+ formatter = pkgs.alejandra;
+ };
+}