Elixir
All checks were successful
/ check (push) Successful in 5m10s

This commit is contained in:
Daniel Flanagan 2024-12-23 19:21:49 -06:00
parent ccad1cefd5
commit f2ea15fa7c
4 changed files with 28 additions and 7 deletions

View file

@ -20,3 +20,6 @@ erl_crash.dump
# direnv cache
/.direnv
# nix-generated pre commit hooks
.pre-commit-config.yaml

View file

@ -2,16 +2,28 @@
git-hooks,
pkgs,
...
}: {
}: let
hook = {
command,
stages ? ["pre-commit"],
...
}: {
inherit stages;
enable = true;
name = command;
entry = command;
pass_filenames = false;
};
in {
git-hooks = git-hooks.lib.${pkgs.system}.run {
src = ./..;
hooks = {
alejandra.enable = true;
convco.enable = true;
credo.enable = true;
dialyzer.enable = true;
mix-format.enable = true;
mix-test.enable = true;
credo = hook {command = "mix credo --strict";};
formatting = hook {command = "mix format --check-formatted";};
dialyzer = hook {command = "mix dialyzer";};
test = hook {command = "mix test";};
};
};
}

View file

@ -14,6 +14,7 @@ in {
pname = "mix-deps-${pname}";
sha256 = pkgs.lib.fakeSha256;
};
LANG = "C.UTF-8";
# buildInputs = with pkgs; [];
# HOME = "$(pwd)";
# MIX_XDG = "$HOME";

View file

@ -1,15 +1,20 @@
{
pkgs,
# self,
self,
...
}: {
elixir-dev = pkgs.mkShell {
shellHook = "export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive";
shellHook = ''
${self.checks.${pkgs.system}.git-hooks.shellHook}
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
'';
# inputsFrom = [self.packages.${pkgs.system}.my-package];
buildInputs = with pkgs; [
elixir
elixir-ls
inotify-tools
];
MIX_ENV = "dev";
};
default = self.outputs.devShells.${pkgs.system}.elixir-dev;
}