Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jan 3, 2025
1 parent 7c06ce2 commit d60cc51
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 86 deletions.
91 changes: 5 additions & 86 deletions flake-modules/dev/default.nix
Original file line number Diff line number Diff line change
@@ -1,88 +1,7 @@
{ lib, inputs, ... }:
{
imports =
[ ./devshell.nix ]
++ lib.optional (inputs.git-hooks-nix ? flakeModule) inputs.git-hooks-nix.flakeModule
++ lib.optional (inputs.treefmt-nix ? flakeModule) inputs.treefmt-nix.flakeModule;

perSystem =
{
lib,
pkgs,
...
}:
lib.optionalAttrs (inputs.treefmt-nix ? flakeModule) {
treefmt.config = {
projectRootFile = "flake.nix";
flakeCheck = true;

programs = {
actionlint.enable = true;
clang-format.enable = true;
isort.enable = true;
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
prettier = {
enable = true;

excludes = [ "**.md" ];
};
ruff = {
check = true;
format = true;
};
statix.enable = true;
stylua.enable = true;
shfmt.enable = true;
taplo.enable = true;
};

settings = {
global.excludes = [
".editorconfig"
".envrc"
".git-blame-ignore-revs"
".gitignore"
"LICENSE"
"flake.lock"
"**.md"
"**.scm"
"**.svg"
"**/man/*.5"
];
formatter.ruff-format.options = [ "--isolated" ];
};
};
}
// lib.optionalAttrs (inputs.git-hooks-nix ? flakeModule) {
pre-commit = {
check.enable = false;

settings.hooks = {
actionlint.enable = true;
clang-tidy.enable = true;
deadnix = {
enable = true;

settings = {
edit = true;
};
};
eslint = {
enable = true;
package = pkgs.eslint_d;
};
luacheck.enable = true;
pre-commit-hook-ensure-sops.enable = true;
statix.enable = true;
treefmt.enable = true;
typos = {
enable = true;
excludes = [ "generated/*" ];
};
};
};
};
imports = [
./devshell.nix
./git-hooks.nix
./treefmt.nix
];
}
40 changes: 40 additions & 0 deletions flake-modules/dev/git-hooks.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib, inputs, ... }:
{
imports = lib.optional (inputs.git-hooks-nix ? flakeModule) inputs.git-hooks-nix.flakeModule;

perSystem =
{
lib,
pkgs,
...
}:
lib.optionalAttrs (inputs.git-hooks-nix ? flakeModule) {
pre-commit = {
check.enable = false;

settings.hooks = {
actionlint.enable = true;
clang-tidy.enable = true;
deadnix = {
enable = true;

settings = {
edit = true;
};
};
eslint = {
enable = true;
package = pkgs.eslint_d;
};
luacheck.enable = true;
pre-commit-hook-ensure-sops.enable = true;
statix.enable = true;
treefmt.enable = true;
typos = {
enable = true;
excludes = [ "generated/*" ];
};
};
};
};
}
56 changes: 56 additions & 0 deletions flake-modules/dev/treefmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ lib, inputs, ... }:
{
imports = lib.optional (inputs.treefmt-nix ? flakeModule) inputs.treefmt-nix.flakeModule;

perSystem =
{
lib,
pkgs,
...
}:
lib.optionalAttrs (inputs.treefmt-nix ? flakeModule) {
treefmt.config = {
projectRootFile = "flake.nix";
flakeCheck = true;

programs = {
actionlint.enable = true;
clang-format.enable = true;
isort.enable = true;
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
prettier = {
enable = true;

excludes = [ "**.md" ];
};
ruff = {
check = true;
format = true;
};
statix.enable = true;
stylua.enable = true;
shfmt.enable = true;
taplo.enable = true;
};

settings = {
global.excludes = [
".editorconfig"
".envrc"
".git-blame-ignore-revs"
".gitignore"
"LICENSE"
"flake.lock"
"**.md"
"**.scm"
"**.svg"
"**/man/*.5"
];
formatter.ruff-format.options = [ "--isolated" ];
};
};
};
}

0 comments on commit d60cc51

Please sign in to comment.