From 4fec87e212697a3f58245eb71a054357aa9f0898 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 1 Apr 2024 12:56:56 +0200 Subject: refactor(templates): Instantiate all symlinks Symlinks are copied verbatim, when nix initializes a template, thus symlinking common files does not work. --- templates/rust/treefmt.nix | 74 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) mode change 120000 => 100644 templates/rust/treefmt.nix (limited to 'templates/rust/treefmt.nix') diff --git a/templates/rust/treefmt.nix b/templates/rust/treefmt.nix deleted file mode 120000 index 6a4fe7d..0000000 --- a/templates/rust/treefmt.nix +++ /dev/null @@ -1 +0,0 @@ -../../treefmt.nix \ No newline at end of file diff --git a/templates/rust/treefmt.nix b/templates/rust/treefmt.nix new file mode 100644 index 0000000..1cbab40 --- /dev/null +++ b/templates/rust/treefmt.nix @@ -0,0 +1,73 @@ +{ + 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"]; + }; + }; + }; + } +) -- cgit 1.4.1