40 lines
916 B
Nix
40 lines
916 B
Nix
{
|
|
pkgs ? (
|
|
let
|
|
inherit (builtins) fetchTree fromJSON readFile;
|
|
inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix;
|
|
in
|
|
import (fetchTree nixpkgs.locked) {
|
|
overlays = [
|
|
(import "${fetchTree gomod2nix.locked}/overlay.nix")
|
|
];
|
|
}
|
|
),
|
|
mkGoEnv ? pkgs.mkGoEnv,
|
|
gomod2nix ? pkgs.gomod2nix,
|
|
pre-commit-hooks,
|
|
}: let
|
|
goEnv = mkGoEnv {pwd = ./.;};
|
|
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
|
|
src = ./.;
|
|
hooks = {
|
|
# General formaters
|
|
end-of-file-fixer.enable = true;
|
|
mixed-line-endings.enable = true;
|
|
# Git commit lint
|
|
commitizen.enable = true;
|
|
# Go section
|
|
gofmt.enable = true;
|
|
# golangci-lint.enable = true;
|
|
govet.enable = true;
|
|
};
|
|
};
|
|
in
|
|
pkgs.mkShell {
|
|
inherit (pre-commit-check) shellHook;
|
|
packages = [
|
|
goEnv
|
|
gomod2nix
|
|
];
|
|
}
|