2023-12-23 15:50:47 +03:00
|
|
|
{inputs, ...}: {
|
|
|
|
imports = [
|
|
|
|
inputs.flake-parts.flakeModules.easyOverlay
|
|
|
|
];
|
|
|
|
|
|
|
|
perSystem = {
|
|
|
|
self',
|
|
|
|
inputs',
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
packages = rec {
|
|
|
|
treefmt = inputs'.gomod2nix.legacyPackages.buildGoApplication rec {
|
|
|
|
pname = "treefmt";
|
|
|
|
version = "0.0.1+dev";
|
|
|
|
|
|
|
|
# ensure we are using the same version of go to build with
|
|
|
|
inherit (pkgs) go;
|
|
|
|
|
|
|
|
src = ../.;
|
|
|
|
modules = ../gomod2nix.toml;
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-X 'build.Name=${pname}'"
|
|
|
|
"-X 'build.Version=${version}'"
|
|
|
|
];
|
|
|
|
|
2024-01-11 23:52:22 +03:00
|
|
|
nativeBuildInputs =
|
|
|
|
# we need some formatters available for the tests
|
2024-01-12 14:33:14 +03:00
|
|
|
(import ./formatters.nix pkgs);
|
2024-01-03 12:20:32 +03:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
XDG_CACHE_HOME=$(mktemp -d)
|
|
|
|
export XDG_CACHE_HOME
|
|
|
|
'';
|
|
|
|
|
2023-12-23 15:50:47 +03:00
|
|
|
meta = with lib; {
|
|
|
|
description = "treefmt: one CLI to format your repo";
|
2023-12-23 16:39:16 +03:00
|
|
|
homepage = "https://git.numtide.com/numtide/treefmt";
|
2023-12-23 15:50:47 +03:00
|
|
|
license = licenses.mit;
|
|
|
|
mainProgram = "treefmt";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
default = treefmt;
|
|
|
|
};
|
|
|
|
|
|
|
|
overlayAttrs = self'.packages;
|
|
|
|
};
|
|
|
|
}
|