Unverified Commit 2b94dff3 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

bash-language-server: 5.4.0 -> 5.6.0, make reproducible (#418130)

parents 0aee47f4 32a10669
Loading
Loading
Loading
Loading
+33 −18
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  stdenvNoCC,
  fetchFromGitHub,
  pnpm_8,
  pnpm_10,
  nodejs,
  makeBinaryWrapper,
  shellcheck,
  versionCheckHook,
}:

stdenv.mkDerivation (finalAttrs: {
stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "bash-language-server";
  version = "5.4.0";
  version = "5.6.0";

  src = fetchFromGitHub {
    owner = "bash-lsp";
    repo = "bash-language-server";
    rev = "server-${finalAttrs.version}";
    hash = "sha256-yJ81oGd9aNsWQMLvDSgMVVH1//Mw/SVFYFIPsJTQYzE=";
    tag = "server-${finalAttrs.version}";
    hash = "sha256-Pe32lQSlyWcyUbqwhfoulwNwhrnWdRcKFIl3Jj0Skac=";
  };

  pnpmWorkspaces = [ "bash-language-server" ];
  pnpmDeps = pnpm_8.fetchDeps {
  pnpmDeps = pnpm_10.fetchDeps {
    inherit (finalAttrs)
      pname
      version
      src
      pnpmWorkspaces
      ;
    hash = "sha256-W25xehcxncBs9QgQBt17F5YHK0b+GDEmt27XzTkyYWg=";
    hash = "sha256-NvyqPv5OKgZi3hW98Da8LhsYatmrzrPX8kLOfLr+BrI=";
  };

  nativeBuildInputs = [
    nodejs
    pnpm_8.configHook
    pnpm_10.configHook
    makeBinaryWrapper
    versionCheckHook
  ];
@@ -45,31 +45,46 @@ stdenv.mkDerivation (finalAttrs: {
    runHook postBuild
  '';

  preInstall = ''
    # remove unnecessary files
    rm node_modules/.modules.yaml
    pnpm --ignore-scripts --prod prune
    rm -r node_modules/.pnpm/@mixmark-io*/node_modules/@mixmark-io/domino/{test,.yarn}
    find -type f \( -name "*.ts" -o -name "*.map" \) -exec rm -rf {} +
    # https://github.com/pnpm/pnpm/issues/3645
    find node_modules server/node_modules -xtype l -delete

    # remove non-deterministic files
    rm node_modules/{.modules.yaml,.pnpm-workspace-state.json}
  '';

  installPhase = ''
    runHook preInstall

    pnpm --offline \
      --frozen-lockfile --ignore-script \
      --filter=bash-language-server \
      deploy --prod $out/lib/bash-language-server
    mkdir -p $out/{bin,lib/bash-language-server}
    cp -r {node_modules,server} $out/lib/bash-language-server/

    # Create the executable, based upon what happens in npmHooks.npmInstallHook
    makeWrapper ${lib.getExe nodejs} $out/bin/bash-language-server \
      --suffix PATH : ${lib.makeBinPath [ shellcheck ]} \
      --inherit-argv0 \
      --add-flags $out/lib/bash-language-server/out/cli.js
      --add-flags $out/lib/bash-language-server/server/out/cli.js

    runHook postInstall
  '';

  doInstallCheck = true;

  meta = with lib; {
  meta = {
    description = "Language server for Bash";
    homepage = "https://github.com/bash-lsp/bash-language-server";
    license = licenses.mit;
    maintainers = with maintainers; [ doronbehar ];
    changelog = "https://github.com/bash-lsp/bash-language-server/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      doronbehar
      gepbird
    ];
    mainProgram = "bash-language-server";
    platforms = platforms.all;
    platforms = lib.platforms.all;
  };
})