Skip to content

Commit

Permalink
Add weeder to local dev tool chain.
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Jun 12, 2024
1 parent 906c8a9 commit c6bee26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ ghcid:

# Used by CI
.PHONY: lint-all
lint-all: formatc hlint-check-all check-local-nix-derivations treefmt-check
lint-all: formatc hlint-check-all check-local-nix-derivations treefmt-check # weeder (does not work on CI yet)

.PHONY: weeder
weeder:
time weeder -N || echo -e '\n\n*** make sure you have added this to your cabal.project.local and make clean before building wire-server:\n\npackage *\n ghc-options: -fwrite-ide-info\n\n'

.PHONY: hlint-check-all
hlint-check-all:
Expand Down
10 changes: 10 additions & 0 deletions nix/haskell-pins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ let
"warp" = "warp";
};
};

# https://github.com/ocharles/weeder/pull/165
weeder = {
src = pkgs.fetchFromGitHub {
owner = "fisx";
repo = "weeder";
rev = "027571e39a25aa0cfa6a7c7effcb868757527a2c";
hash = "sha256-E35PVxi/4iJFfWts3td52KKZKQt4dj9KFP3SvWG77Cc=";
};
};
};
hackagePins = {
# Major re-write upstream, we should get rid of this dependency rather than
Expand Down
1 change: 1 addition & 0 deletions nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ let
pkgs.cfssl
pkgs.awscli2
(hlib.justStaticExecutables pkgs.haskellPackages.cabal-fmt)
(hlib.justStaticExecutables pkgs.haskellPackages.weeder)
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.skopeo
];
Expand Down
6 changes: 6 additions & 0 deletions weeder.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# weeder intro and further reading: https://github.com/ocharles/weeder?tab=readme-ov-file#weeder
roots = ["^Main.main$", "^Paths_.*\\..*"]
type-class-roots = true # `root-instances` is more precise, but requires more config maintenance.

# TODO: unused-types = true
# TODO: type-class-roots = false, and see how bad it gets

0 comments on commit c6bee26

Please sign in to comment.