Merge pull request #306125 from gabyx/feature/add-githooks-application

githooks: init at 3.0.1

authored by Aleksana and committed by GitHub 2524cd6d 981439b2

+85
+85
pkgs/by-name/gi/githooks/package.nix
··· 1 + { 2 + lib, 3 + buildGoModule, 4 + fetchFromGitHub, 5 + git, 6 + testers, 7 + makeWrapper, 8 + }: 9 + buildGoModule rec { 10 + pname = "githooks"; 11 + version = "3.0.1"; 12 + 13 + src = fetchFromGitHub { 14 + owner = "gabyx"; 15 + repo = "githooks"; 16 + rev = "v${version}"; 17 + hash = "sha256-qv0nl3EEYVo/s79r+yK3ZQCGPXM2bzGdWatPY24aOZg="; 18 + }; 19 + 20 + modRoot = "./githooks"; 21 + vendorHash = "sha256-ZcDD4Z/thtyCvXg6GzzKC/FSbh700QEaqXU8FaZaZc4="; 22 + 23 + nativeBuildInputs = [ makeWrapper ]; 24 + 25 + buildInputs = [ git ]; 26 + 27 + strictDeps = true; 28 + 29 + ldflags = [ 30 + "-s" # Disable symbole table. 31 + "-w" # Disable DWARF generation. 32 + ]; 33 + 34 + # We need to disable updates and other features: 35 + # That is done with tag `package_manager_enabled`. 36 + tags = [ "package_manager_enabled" ]; 37 + 38 + checkFlags = 39 + let 40 + skippedTests = [ 41 + "TestGithooksCompliesWithGit" # Needs internet to download all hooks documentation. 42 + "TestUpdateImages" # Needs docker/podman. 43 + ]; 44 + in 45 + [ 46 + "-v" 47 + "-skip" 48 + "(${builtins.concatStringsSep "|" skippedTests})" 49 + ]; 50 + 51 + doCheck = true; 52 + 53 + # We need to generate some build files before building. 54 + postConfigure = '' 55 + GH_BUILD_VERSION="${version}" \ 56 + GH_BUILD_TAG="v${version}" \ 57 + go generate -mod=vendor ./... 58 + ''; 59 + 60 + postInstall = '' 61 + # Rename executable to proper names. 62 + mv $out/bin/cli $out/bin/githooks-cli 63 + mv $out/bin/runner $out/bin/githooks-runner 64 + mv $out/bin/dialog $out/bin/githooks-dialog 65 + ''; 66 + 67 + postFixup = '' 68 + wrapProgram "$out/bin/githooks-cli" --prefix PATH : ${lib.makeBinPath [ git ]} 69 + wrapProgram "$out/bin/githooks-runner" --prefix PATH : ${lib.makeBinPath [ git ]} 70 + ''; 71 + 72 + passthru.tests.version = testers.testVersion { 73 + package = "githooks-cli"; 74 + command = "githooks-cli --version"; 75 + inherit version; 76 + }; 77 + 78 + meta = with lib; { 79 + description = "A Git hooks manager with per-repo and shared Git hooks including version control"; 80 + homepage = "https://github.com/gabyx/Githooks"; 81 + license = licenses.mpl20; 82 + maintainers = with maintainers; [ gabyx ]; 83 + mainProgram = "githooks-cli"; 84 + }; 85 + }