diff --git a/pkgs/by-name/zi/zig-zlint/build.zig.zon.nix b/pkgs/by-name/zi/zig-zlint/build.zig.zon.nix new file mode 100644 index 000000000000..dbdbc40b385e --- /dev/null +++ b/pkgs/by-name/zi/zig-zlint/build.zig.zon.nix @@ -0,0 +1,31 @@ +# generated by zon2nix (https://github.com/nix-community/zon2nix) + +{ + linkFarm, + fetchzip, + fetchgit, +}: + +linkFarm "zig-packages" [ + { + name = "chameleon-3.0.0-bqfnCfhtAAAAxXGw5t9odkb4ayCTTqOcPvL-TgSMUacF"; + path = fetchzip { + url = "https://github.com/DonIsaac/chameleon/archive/7c7477fa76da53c2791f9e1f860481f64140ccbc.zip"; + hash = "sha256-fbKhLQLE/6aHmpYr8+daxyUSWNpDq5zApHP4brRYvlo="; + }; + } + { + name = "recover-1.1.0-Zd97oqomAADqISI8KEhW_UUjiPSExhw9hzeoNpg1Nveo"; + path = fetchzip { + url = "https://github.com/dimdin/zig-recover/archive/36133afaa1b085db7063ffc97c08ae0bddc2de4e.zip"; + hash = "sha256-0oPP6BLVEIR79Q8KcvOlSeDfNLT+8inmIU6ZkuJWrfU="; + }; + } + { + name = "smart_pointers-0.0.3-NPos2MOwAABoujUzLcVLofXqRAgYWLc5pG-TKDhyK0cq"; + path = fetchzip { + url = "https://github.com/DonIsaac/smart-pointers/archive/refs/tags/v0.0.3.tar.gz"; + hash = "sha256-oSI76wyiAX7YDvKGhzRbZdEvl7+DPLtMb56w0QsYrkg="; + }; + } +] diff --git a/pkgs/by-name/zi/zig-zlint/package.nix b/pkgs/by-name/zi/zig-zlint/package.nix new file mode 100644 index 000000000000..19a689ba6374 --- /dev/null +++ b/pkgs/by-name/zi/zig-zlint/package.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenv, + fetchFromGitHub, + callPackage, + zig_0_14, + versionCheckHook, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "zig-zlint"; + version = "0.7.6"; + + src = fetchFromGitHub { + name = "zlint"; # tests expect this + owner = "DonIsaac"; + repo = "zlint"; + tag = "v${finalAttrs.version}"; + hash = "sha256-S0FhugmrNHCEpIWX7oL1vZ8heikpo/mok7ciTgSdOpg="; + }; + + nativeBuildInputs = [ + zig_0_14.hook + ]; + + zigBuildFlags = [ + "-Dversion=v${finalAttrs.version}" + "--system" + (callPackage ./build.zig.zon.nix { }) + ]; + + doCheck = true; + zigCheckFlags = finalAttrs.zigBuildFlags; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/zlint"; + versionCheckProgramArg = "--version"; + + # `zig build` produces a lot more artifacts, just copy over the ones we want + installPhase = '' + runHook preInstall + install -vDm755 zig-out/bin/zlint $out/bin/zlint + runHook postInstall + ''; + + meta = { + description = "Linter for the Zig programming language"; + homepage = "https://github.com/DonIsaac/zlint"; + changelog = "https://github.com/DonIsaac/zlint/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ christoph-heiss ]; + mainProgram = "zlint"; + inherit (zig_0_14.meta) platforms; + }; +})