feat: add treefmt to flake root

This commit is contained in:
2026-06-07 21:58:16 -05:00
parent ba2dce4b85
commit 0d1a37eef3
6 changed files with 33 additions and 12 deletions
+11 -6
View File
@@ -44,8 +44,9 @@
# Build *just* the cargo dependencies, so we can reuse
# all of that work (e.g. via cachix) when running in CI
cargoArtifacts = craneLib.buildDepsOnly ({
inherit src buildInputs nativeBuildInputs;
} // cfg.cargoArtifacts.extraAttrs);
inherit src buildInputs nativeBuildInputs;
}
// cfg.cargoArtifacts.extraAttrs);
in {
options.krantz.rust = {
enable = lib.mkEnableOption "building a cargo project with crane";
@@ -66,7 +67,11 @@
srcToolchain = lib.mkOption {
description = "A path to the rust-toolchain(.toml) file for the repo. Will use the toolchain from nixpkgs if the file does not exist.";
type = lib.types.path;
default = "${if cfg.src != null then cfg.src else "/dev/null"}/rust-toolchain.toml";
default = "${
if cfg.src != null
then cfg.src
else "/dev/null"
}/rust-toolchain.toml";
defaultText = lib.literalExpression "cfg.src + \"/rust-toolchain.toml\"";
example = lib.literalExpression "./rust-toolchain";
};
@@ -192,10 +197,10 @@
# Your custom packages
# Accessible through 'nix build', 'nix shell', 'nix run', etc
packages = lib.mkIf cfg.package.enable {
${cfg.package.name} =
craneLib.buildPackage ({
${cfg.package.name} = craneLib.buildPackage ({
inherit src buildInputs nativeBuildInputs cargoArtifacts;
} // cfg.package.extraAttrs);
}
// cfg.package.extraAttrs);
};
# Formatter for nix files, available through 'nix fmt'
+2 -2
View File
@@ -1,7 +1,7 @@
[global]
disable = [
# line length limits
"MD013",
# line length limits
"MD013",
]
[MD057]