diff --git a/pkgs/by-name/ts/tsgolint/package.nix b/pkgs/by-name/ts/tsgolint/package.nix index cc8952259a4a..1adb8648047e 100644 --- a/pkgs/by-name/ts/tsgolint/package.nix +++ b/pkgs/by-name/ts/tsgolint/package.nix @@ -3,49 +3,51 @@ buildGoModule, fetchFromGitHub, findutils, - applyPatches, go, + nix-update-script, }: buildGoModule (finalAttrs: { pname = "tsgolint"; version = "0.10.1"; - src = applyPatches rec { - src = fetchFromGitHub { - owner = "oxc-project"; - repo = "tsgolint"; - tag = "v${finalAttrs.version}"; - hash = "sha256-6cDQjYVNfujIh3s+9pNCfqUEtfdvgx66oZoENqpJ7jE="; - fetchSubmodules = true; - }; - prePatch = '' - cd typescript-go - ''; - # These patches are applied to the typescript-go submodule in justfile's "init" target upstream. - patches = [ - (src + "/patches/0001-Parallel-readDirectory-visitor.patch") - (src + "/patches/0002-Adapt-project-service-for-single-run-mode.patch") - (src + "/patches/0003-patch-expose-more-functions-via-the-shim-with-type-f.patch") - (src + "/patches/0004-feat-improve-panic-message-for-extracting-TS-extensi.patch") - (src + "/patches/0005-fix-early-return-from-invalid-tsconfig-for-better-er.patch") - ]; - # We don't want to build with go.work, so we add the replacement to - # the local module to the go.mod instead. - postPatch = '' - cd .. - ${lib.getExe go} mod edit --replace=github.com/microsoft/typescript-go=./typescript-go - ''; + src = fetchFromGitHub { + owner = "oxc-project"; + repo = "tsgolint"; + tag = "v${finalAttrs.version}"; + hash = "sha256-6cDQjYVNfujIh3s+9pNCfqUEtfdvgx66oZoENqpJ7jE="; + fetchSubmodules = true; }; nativeBuildInputs = [ findutils ]; - # From justfile's "init" target upstream. - postPatch = '' - rm go.work{,.sum} - mkdir -p internal/collections && find ./typescript-go/internal/collections -type f ! -name '*_test.go' -exec cp {} internal/collections/ \; + prePatch = '' + pushd typescript-go ''; + # These patches are applied to the typescript-go submodule in justfile's "init" target upstream. + patches = [ + (finalAttrs.src + "/patches/0001-Parallel-readDirectory-visitor.patch") + (finalAttrs.src + "/patches/0002-Adapt-project-service-for-single-run-mode.patch") + (finalAttrs.src + "/patches/0003-patch-expose-more-functions-via-the-shim-with-type-f.patch") + (finalAttrs.src + "/patches/0004-feat-improve-panic-message-for-extracting-TS-extensi.patch") + (finalAttrs.src + "/patches/0005-fix-early-return-from-invalid-tsconfig-for-better-er.patch") + ]; + + postPatch = + # We don't want to build with go.work, so we add the replacement to + # the local module to the go.mod instead. + '' + popd + ${lib.getExe go} mod edit --replace=github.com/microsoft/typescript-go=./typescript-go + '' + + + # From justfile's "init" target upstream. + '' + rm go.work{,.sum} + mkdir -p internal/collections && find ./typescript-go/internal/collections -type f ! -name '*_test.go' -exec cp {} internal/collections/ \; + ''; + proxyVendor = true; vendorHash = "sha256-t1qyCdMeA5rh5/9yQ9LAhRO+0nSiMyFHp3sSPOJQWQA="; @@ -53,6 +55,10 @@ buildGoModule (finalAttrs: { env.GOEXPERIMENT = "greenteagc"; + passthru = { + updateScript = nix-update-script { }; + }; + meta = { description = "Type aware linting for oxlint"; homepage = "https://github.com/oxc-project/tsgolint";