Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 76 lines 1.8 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 fetchYarnDeps, 5 makeWrapper, 6 nodejs, 7 stdenv, 8 yarnBuildHook, 9 yarnConfigHook, 10 versionCheckHook, 11}: 12 13stdenv.mkDerivation (finalAttrs: { 14 pname = "graphql-language-service-cli"; 15 version = "3.5.0"; 16 17 src = fetchFromGitHub { 18 owner = "graphql"; 19 repo = "graphiql"; 20 tag = "graphql-language-service-cli@${finalAttrs.version}"; 21 hash = "sha256-NJTggaMNMjOP5oN+gHxFTwEdNipPNzTFfA6f975HDgM="; 22 }; 23 24 patches = [ 25 ./patches/0001-repurpose-vscode-graphql-build-script.patch 26 ]; 27 28 yarnOfflineCache = fetchYarnDeps { 29 yarnLock = "${finalAttrs.src}/yarn.lock"; 30 hash = "sha256-ae6KP2sFgw8/8YaTJSPscBlVQ5/bzbvHRZygcMgFAlU="; 31 }; 32 33 nativeBuildInputs = [ 34 yarnConfigHook 35 yarnBuildHook 36 nodejs 37 makeWrapper 38 ]; 39 40 installPhase = '' 41 runHook preInstall 42 43 mkdir -p $out/{bin,lib} 44 45 pushd packages/graphql-language-service-cli 46 47 node esbuild.js --minify 48 49 # copy package.json for --version command 50 mv {out/graphql.js,package.json} $out/lib 51 52 makeWrapper ${lib.getExe nodejs} $out/bin/graphql-lsp \ 53 --add-flags $out/lib/graphql.js \ 54 55 popd 56 57 runHook postInstall 58 ''; 59 60 nativeInstallCheckInputs = [ versionCheckHook ]; 61 doInstallCheck = true; 62 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"; 63 64 passthru = { 65 updateScript = ./updater.sh; 66 }; 67 68 meta = { 69 description = "Official, runtime independent Language Service for GraphQL"; 70 homepage = "https://github.com/graphql/graphiql"; 71 changelog = "https://github.com/graphql/graphiql/blob/${finalAttrs.src.tag}/packages/graphql-language-service-cli/CHANGELOG.md"; 72 license = lib.licenses.mit; 73 maintainers = with lib.maintainers; [ nathanregner ]; 74 mainProgram = "graphql-lsp"; 75 }; 76})