fix: nix build

- 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>
This commit is contained in:
Brian McGee 2024-01-03 09:20:32 +00:00
parent 811f883a2b
commit 4a78a1e319
Signed by: brianmcgee
GPG Key ID: D49016E76AD1E8C0
4 changed files with 36 additions and 24 deletions

View File

@ -46,6 +46,9 @@ schema = 3
[mod."github.com/muesli/termenv"]
version = "v0.15.2"
hash = "sha256-Eum/SpyytcNIchANPkG4bYGBgcezLgej7j/+6IhqoMU="
[mod."github.com/otiai10/copy"]
version = "v1.14.0"
hash = "sha256-xsaL1ddkPS544y0Jv7u/INUALBYmYq29ddWvysLXk4A="
[mod."github.com/pmezard/go-difflib"]
version = "v1.0.0"
hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA="
@ -61,9 +64,6 @@ schema = 3
[mod."github.com/vmihailenco/tagparser/v2"]
version = "v2.0.0"
hash = "sha256-M9QyaKhSmmYwsJk7gkjtqu9PuiqZHSmTkous8VWkWY0="
[mod."github.com/ztrue/shutdown"]
version = "v0.1.1"
hash = "sha256-+ygx5THHu9g+vBAn6b63tV35bvQGdRyto4pLhkontJI="
[mod."go.etcd.io/bbolt"]
version = "v1.3.8"
hash = "sha256-ekKy8198B2GfPldHLYZnvNjID6x07dUPYKgFx84TgVs="

View File

@ -20,27 +20,15 @@
}
];
packages = with pkgs; [
# golang
go
gotools
delve
golangci-lint
# formatters for testing
alejandra
elmPackages.elm-format
haskellPackages.cabal-fmt
haskellPackages.ormolu
mdsh
nodePackages.prettier
python3.pkgs.black
rufo
rustfmt
shellcheck
shfmt
terraform
];
packages = with pkgs;
[
# golang
go
delve
]
++
# include formatters for development and testing
(import ./formatters.nix pkgs);
commands = [
{

16
nix/formatters.nix Normal file
View File

@ -0,0 +1,16 @@
pkgs:
with pkgs; [
alejandra
elmPackages.elm-format
gotools
haskellPackages.cabal-fmt
haskellPackages.ormolu
mdsh
nodePackages.prettier
python3.pkgs.black
rufo
rustfmt
shellcheck
shfmt
terraform
]

View File

@ -26,6 +26,14 @@
"-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";