feat: init
This commit is contained in:
commit
06c3330999
16 changed files with 3817 additions and 0 deletions
70
templates/default/nix/formatter.nix
Normal file
70
templates/default/nix/formatter.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
perSystem,
|
||||
...
|
||||
}:
|
||||
let
|
||||
settingsNix = {
|
||||
package = perSystem.nixpkgs.treefmt2;
|
||||
|
||||
projectRootFile = ".git/config";
|
||||
|
||||
programs = {
|
||||
nixfmt.enable = true;
|
||||
deadnix = {
|
||||
enable = true;
|
||||
no-underscore = true;
|
||||
};
|
||||
statix.enable = true;
|
||||
|
||||
rustfmt.enable = true;
|
||||
|
||||
gofmt.enable = true;
|
||||
|
||||
shfmt.enable = true;
|
||||
|
||||
prettier.enable = true;
|
||||
} // pkgs.lib.optionalAttrs (pkgs.system != "riscv64-linux") { shellcheck.enable = true; };
|
||||
|
||||
settings = {
|
||||
global.excludes = [
|
||||
"LICENSE"
|
||||
# unsupported extensions
|
||||
"*.{gif,png,svg,tape,mts,lock,mod,sum,toml,env,envrc,gitignore}"
|
||||
];
|
||||
|
||||
formatter = {
|
||||
deadnix = {
|
||||
priority = 1;
|
||||
};
|
||||
|
||||
nixfmt = {
|
||||
priority = 2;
|
||||
};
|
||||
|
||||
statix = {
|
||||
priority = 3;
|
||||
};
|
||||
|
||||
prettier = {
|
||||
options = [
|
||||
"--tab-width"
|
||||
"2"
|
||||
];
|
||||
includes = [ "*.{css,html,js,json,jsx,md,mdx,scss,ts,yaml}" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs settingsNix;
|
||||
|
||||
in
|
||||
treefmtEval.config.build.wrapper.overrideAttrs (_: {
|
||||
passthru = {
|
||||
inherit (treefmtEval.config) package settings;
|
||||
inherit (treefmtEval) config;
|
||||
inherit settingsNix;
|
||||
};
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue