Skip to content

Commit

Permalink
fix: nix build
Browse files Browse the repository at this point in the history
- update `gomod2nix.toml`
- add formatters as `nativeBuildInputs` for nix build
- export a `XDG_CACHE_HOME` for checks

Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed Jan 3, 2024
1 parent 811f883 commit 4a78a1e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
6 changes: 3 additions & 3 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="
Expand All @@ -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="
Expand Down
30 changes: 9 additions & 21 deletions nix/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down
16 changes: 16 additions & 0 deletions nix/formatters.nix
Original file line number Diff line number Diff line change
@@ -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
]
8 changes: 8 additions & 0 deletions nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 4a78a1e

Please sign in to comment.