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 cache
/.direnv /.direnv
# nix-generated pre commit hooks
.pre-commit-config.yaml

View file

@ -2,16 +2,28 @@
git-hooks, git-hooks,
pkgs, 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 { git-hooks = git-hooks.lib.${pkgs.system}.run {
src = ./..; src = ./..;
hooks = { hooks = {
alejandra.enable = true; alejandra.enable = true;
convco.enable = true; convco.enable = true;
credo.enable = true; credo = hook {command = "mix credo --strict";};
dialyzer.enable = true; formatting = hook {command = "mix format --check-formatted";};
mix-format.enable = true; dialyzer = hook {command = "mix dialyzer";};
mix-test.enable = true; test = hook {command = "mix test";};
}; };
}; };
} }

View file

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

View file

@ -1,15 +1,20 @@
{ {
pkgs, pkgs,
# self, self,
... ...
}: { }: {
elixir-dev = pkgs.mkShell { 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]; # inputsFrom = [self.packages.${pkgs.system}.my-package];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
elixir elixir
elixir-ls elixir-ls
inotify-tools inotify-tools
]; ];
MIX_ENV = "dev";
}; };
default = self.outputs.devShells.${pkgs.system}.elixir-dev;
} }