2024-05-13 12:47:39 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildGoModule,
|
2025-03-05 03:10:57 +00:00
|
|
|
callPackages,
|
2024-05-13 12:47:39 +02:00
|
|
|
fetchFromGitHub,
|
|
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "treefmt";
|
2025-05-21 13:37:06 +01:00
|
|
|
version = "2.3.1";
|
2024-05-13 12:47:39 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "numtide";
|
|
|
|
repo = "treefmt";
|
2025-04-08 02:51:45 -04:00
|
|
|
rev = "v${version}";
|
2025-05-21 13:37:06 +01:00
|
|
|
hash = "sha256-Z1AGLaGrRrUd75aQJc/UKwzMGb9gI/p5WxQ5XUgp98o=";
|
2024-05-13 12:47:39 +02:00
|
|
|
};
|
|
|
|
|
2025-05-16 15:19:37 +01:00
|
|
|
vendorHash = "sha256-9yAvqz99YlBfFU/hGs1PB/sH0iOyWaVadqGhfXMkj5E=";
|
2024-05-13 12:47:39 +02:00
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2024-11-28 08:10:54 +08:00
|
|
|
env.CGO_ENABLED = 1;
|
2024-05-13 12:47:39 +02:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2024-11-29 14:52:24 +00:00
|
|
|
"-X github.com/numtide/treefmt/v2/build.Name=treefmt"
|
|
|
|
"-X github.com/numtide/treefmt/v2/build.Version=v${version}"
|
2024-05-13 12:47:39 +02:00
|
|
|
];
|
|
|
|
|
2025-03-05 03:10:57 +00:00
|
|
|
passthru = {
|
2025-05-19 16:22:32 +01:00
|
|
|
inherit (callPackages ./lib.nix { })
|
|
|
|
evalConfig
|
|
|
|
withConfig
|
|
|
|
buildConfig
|
|
|
|
;
|
2025-03-05 03:10:57 +00:00
|
|
|
|
|
|
|
tests = callPackages ./tests.nix { };
|
2025-05-14 07:20:21 +01:00
|
|
|
|
|
|
|
# Documentation for functions defined in `./lib.nix`
|
|
|
|
functionsDoc = callPackages ./functions-doc.nix { };
|
2025-05-13 07:15:15 +01:00
|
|
|
|
|
|
|
# Documentation for options declared in `treefmt.evalConfig` configurations
|
|
|
|
optionsDoc = callPackages ./options-doc.nix { };
|
2025-03-05 03:10:57 +00:00
|
|
|
};
|
|
|
|
|
2024-05-13 12:47:39 +02:00
|
|
|
meta = {
|
2025-07-23 04:23:40 +00:00
|
|
|
description = "One CLI to format the code tree";
|
2025-05-14 22:25:47 +01:00
|
|
|
longDescription = ''
|
|
|
|
[treefmt](${meta.homepage}) streamlines the process of applying formatters
|
|
|
|
to your project, making it a breeze with just one command line.
|
|
|
|
|
|
|
|
The `treefmt` package provides functions for configuring treefmt using
|
|
|
|
the module system, which are documented in the [treefmt section] of the
|
|
|
|
Nixpkgs Manual.
|
|
|
|
|
|
|
|
Alternatively, treefmt can be configured using [treefmt-nix].
|
|
|
|
|
|
|
|
[treefmt section]: https://nixos.org/manual/nixpkgs/unstable#treefmt
|
|
|
|
[treefmt-nix]: https://github.com/numtide/treefmt-nix
|
|
|
|
'';
|
2024-05-13 12:47:39 +02:00
|
|
|
homepage = "https://github.com/numtide/treefmt";
|
|
|
|
license = lib.licenses.mit;
|
2025-03-15 12:35:49 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
brianmcgee
|
|
|
|
MattSturgeon
|
|
|
|
zimbatm
|
2024-05-13 12:47:39 +02:00
|
|
|
];
|
|
|
|
mainProgram = "treefmt";
|
|
|
|
};
|
|
|
|
}
|