summaryrefslogtreecommitdiff
path: root/parts/dev.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-05-21 18:11:53 -0400
committerseth <[email protected]>2023-05-21 18:11:53 -0400
commitd1878f3e55371affe603459c540954c631d6462f (patch)
treecd7fbdef347569aa7ed57237d96539b1500dd774 /parts/dev.nix
parent913f1bf789e4ad9d7bae13e13d318620cea6761b (diff)
feat: start using flake-parts + add nixos module
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;
+ };
+}