nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 56 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 callPackage, 6 zig_0_14, 7 versionCheckHook, 8}: 9 10stdenv.mkDerivation (finalAttrs: { 11 pname = "zig-zlint"; 12 version = "0.7.9"; 13 14 src = fetchFromGitHub { 15 name = "zlint"; # tests expect this 16 owner = "DonIsaac"; 17 repo = "zlint"; 18 tag = "v${finalAttrs.version}"; 19 hash = "sha256-qJPOFMBvkvF10ixE17pV9X5LX3EyCVzzhrMGx1omTzE="; 20 }; 21 22 nativeBuildInputs = [ 23 zig_0_14.hook 24 ]; 25 26 zigBuildFlags = [ 27 "-Dversion=v${finalAttrs.version}" 28 "--system" 29 (callPackage ./build.zig.zon.nix { }) 30 ]; 31 32 doCheck = true; 33 zigCheckFlags = finalAttrs.zigBuildFlags; 34 35 doInstallCheck = true; 36 nativeInstallCheckInputs = [ versionCheckHook ]; 37 versionCheckProgram = "${placeholder "out"}/bin/zlint"; 38 versionCheckProgramArg = "--version"; 39 40 # `zig build` produces a lot more artifacts, just copy over the ones we want 41 installPhase = '' 42 runHook preInstall 43 install -vDm755 zig-out/bin/zlint $out/bin/zlint 44 runHook postInstall 45 ''; 46 47 meta = { 48 description = "Linter for the Zig programming language"; 49 homepage = "https://github.com/DonIsaac/zlint"; 50 changelog = "https://github.com/DonIsaac/zlint/releases/tag/v${finalAttrs.version}"; 51 license = lib.licenses.mit; 52 maintainers = with lib.maintainers; [ christoph-heiss ]; 53 mainProgram = "zlint"; 54 inherit (zig_0_14.meta) platforms; 55 }; 56})