This repository has been archived on 2024-05-26. You can view files and clone it, but cannot push or open issues or pull requests.
core/treefmt.nix

99 lines
2.8 KiB
Nix
Raw Permalink Normal View History

# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: MIT
#
# This file is part of Trinitrix.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the “Software”), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
{
treefmt-nix,
pkgs,
}:
treefmt-nix.lib.evalModule pkgs (
{pkgs, ...}: {
# Used to find the project root
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
rustfmt.enable = true;
clang-format.enable = true;
mdformat.enable = true;
shfmt = {
enable = true;
indent_size = 4;
};
shellcheck.enable = true;
prettier = {
settings = {
arrowParens = "always";
bracketSameLine = false;
bracketSpacing = true;
editorconfig = true;
embeddedLanguageFormatting = "auto";
endOfLine = "lf";
# experimentalTernaries = false;
htmlWhitespaceSensitivity = "css";
insertPragma = false;
jsxSingleQuote = true;
printWidth = 80;
proseWrap = "always";
quoteProps = "consistent";
requirePragma = false;
semi = true;
singleAttributePerLine = true;
singleQuote = true;
trailingComma = "all";
useTabs = false;
vueIndentScriptAndStyle = false;
tabWidth = 4;
overrides = {
files = ["*.js"];
options.tabwidth = 2;
};
};
};
stylua.enable = true;
ruff = {
enable = true;
format = true;
};
taplo.enable = true;
};
settings = {
global.excludes = [
"CHANGELOG.md"
"NEWS.md"
];
formatter = {
clang-format = {
options = ["--style" "GNU"];
};
shfmt = {
includes = ["*.bash"];
};
};
};
}
)