Brian McGee
4a78a1e319
- update `gomod2nix.toml` - add formatters as `nativeBuildInputs` for nix build - export a `XDG_CACHE_HOME` for checks Signed-off-by: Brian McGee <brian@bmcgee.ie>
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{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}'"
|
|
];
|
|
|
|
# we need some formatters available for the tests
|
|
nativeBuildInputs = import ./formatters.nix pkgs;
|
|
|
|
preCheck = ''
|
|
XDG_CACHE_HOME=$(mktemp -d)
|
|
export XDG_CACHE_HOME
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "treefmt: one CLI to format your repo";
|
|
homepage = "https://git.numtide.com/numtide/treefmt";
|
|
license = licenses.mit;
|
|
mainProgram = "treefmt";
|
|
};
|
|
};
|
|
|
|
default = treefmt;
|
|
};
|
|
|
|
overlayAttrs = self'.packages;
|
|
};
|
|
}
|