Skip to content

Commit

Permalink
astro-language-server: init at 2.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrox0 committed Jun 29, 2024
1 parent e9620c8 commit 21c7157
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 396 deletions.
103 changes: 103 additions & 0 deletions pkgs/by-name/as/astro-language-server/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
lib,
stdenv,
fetchFromGitHub,
pnpm_8,
nodejs_22,
jq,
moreutils,
cacert,
stdenvNoCC,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "astro-language-server";
version = "2.10.0";

src = fetchFromGitHub {
owner = "withastro";
repo = "language-tools";
rev = "@astrojs/language-server@${finalAttrs.version}";
hash = "sha256-WdeQQaC9AVHT+/pXLzaC6MZ6ddHsFSpxoDPHqWvqmiQ=";
};

pnpmDeps = stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs) src version;

nativeBuildInputs = [
jq
moreutils
pnpm_8
cacert
];

installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm config set side-effects-cache false
pnpm config set update-notifier false
pnpm config set dedupe-peer-dependents false
pnpm install --filter=@astrojs/language-server --frozen-lockfile --no-optional --ignore-script --force
# Remove timestamp and sort the json files
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';

dontConfigure = true;
dontFixup = true;
dontBuild = true;
outputHashMode = "recursive";
outputHash = "sha256-v88a/NB7geQf4r9fNqV1qkq9m/uATqcS1l0ljgy4Fdg=";
};
nativeBuildInputs = [
nodejs_22
pnpm_8
];

buildInputs = [
nodejs_22
];

preBuild = ''
export HOME=$(mktemp -d)
pnpm config set store-dir ${finalAttrs.pnpmDeps}
pnpm config set recursive-install false
pnpm config set package-manager-strict false
pnpm config set dedupe-peer-dependents false
pnpm install --filter=@astrojs/language-server --offline --frozen-lockfile --no-optional --ignore-script
patchShebangs node_modules/{*,.*}
'';

buildPhase = ''
runHook preBuild
pnpm --filter=@astrojs/language-server build
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib/astro-language-server}
cp -r {packages,node_modules} $out/lib/astro-language-server
ln -s $out/lib/astro-language-server/packages/language-server/bin/nodeServer.js $out/bin/astro-ls
runHook postInstall
'';

meta = {
description = "The Astro language server";
homepage = "https://github.com/withastro/language-tools";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pyrox0 ];
mainProgram = "astro-ls";
platforms = lib.platforms.unix;
};
})
1 change: 1 addition & 0 deletions pkgs/development/node-packages/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ in

mapAliases {
"@antora/cli" = pkgs.antora; # Added 2023-05-06
"@astrojs/language-server" = pkgs.astro-language-server; # Added 2024-02-12
"@bitwarden/cli" = pkgs.bitwarden-cli; # added 2023-07-25
"@emacs-eask/cli" = pkgs.eask; # added 2023-08-17
"@forge/cli" = throw "@forge/cli was removed because it was broken"; # added 2023-09-20
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/node-packages/main-programs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# Packages that provide a single executable.
"@angular/cli" = "ng";
"@astrojs/language-server" = "astro-ls";
"@babel/cli" = "babel";
"@commitlint/cli" = "commitlint";
"@gitbeaker/cli" = "gitbeaker";
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/node-packages/node-packages.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[
"@angular/cli"
, "@antfu/ni"
, "@astrojs/language-server"
, "@babel/cli"
, "@commitlint/cli"
, "@commitlint/config-conventional"
Expand Down
Loading

0 comments on commit 21c7157

Please sign in to comment.