Skip to content

Commit 1e3d9fd

Browse files
committed
aws-cloudformation-languageserver: init at 1.4.0
1 parent 171f8ff commit 1e3d9fd

3 files changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchzip,
5+
makeWrapper,
6+
nodejs,
7+
autoPatchelfHook,
8+
}:
9+
let
10+
sources = builtins.fromJSON (builtins.readFile ./sources.json);
11+
currentSystemSrc =
12+
sources.${stdenv.hostPlatform.system}
13+
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
14+
in
15+
stdenv.mkDerivation (finalAttrs: {
16+
pname = "aws-cloudformation-languageserver";
17+
version = sources.version;
18+
src = fetchzip {
19+
url = currentSystemSrc.url;
20+
sha256 = currentSystemSrc.sha256;
21+
stripRoot = false;
22+
};
23+
nativeBuildInputs = [
24+
makeWrapper
25+
];
26+
27+
installPhase = ''
28+
runHook preInstall
29+
30+
mkdir -p $out/lib/${finalAttrs.pname}
31+
cp -r . $out/lib/${finalAttrs.pname}/
32+
33+
mkdir -p $out/bin
34+
makeWrapper ${nodejs}/bin/node $out/bin/cfn-lsp-server \
35+
--add-flags "$out/lib/${finalAttrs.pname}/cfn-lsp-server-standalone.js"
36+
37+
runHook postInstall
38+
'';
39+
40+
passthru.updateScript = ./update.sh;
41+
42+
meta = {
43+
description = "CloudFormation Language Server";
44+
mainProgram = "cfn-lsp-server";
45+
homepage = "https://github.com/aws-cloudformation/cloudformation-languageserver";
46+
license = lib.licenses.asl20;
47+
platforms = [
48+
"x86_64-linux"
49+
"aarch64-linux"
50+
"x86_64-darwin"
51+
"aarch64-darwin"
52+
];
53+
maintainers = with lib.maintainers; [
54+
mbarneyjr
55+
];
56+
};
57+
})
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "1.4.0",
3+
"aarch64-darwin": {
4+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver/releases/download/v1.4.0/cloudformation-languageserver-1.4.0-darwin-arm64-node22.zip",
5+
"sha256": "sha256-bOI1JT4buFsVaC3c+ZeQEZs0cqAGbDfXieYcrXOs/Cc="
6+
},
7+
"aarch64-linux": {
8+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver/releases/download/v1.4.0/cloudformation-languageserver-1.4.0-linux-arm64-node22.zip",
9+
"sha256": "sha256-Pgpm0lgFnCydt3eJmu8AaURhd1rKS1W4SxzryHnI+VI="
10+
},
11+
"x86_64-darwin": {
12+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver/releases/download/v1.4.0/cloudformation-languageserver-1.4.0-darwin-x64-node22.zip",
13+
"sha256": "sha256-VqpywoM2KtRXJzWygzYBNpfiqTlgUMwWKnmTWmxnz6g="
14+
},
15+
"x86_64-linux": {
16+
"url": "https://github.com/aws-cloudformation/cloudformation-languageserver/releases/download/v1.4.0/cloudformation-languageserver-1.4.0-linux-x64-node22.zip",
17+
"sha256": "sha256-KKwHQQh3Tx+ZGRhT3A9JDYNpydIW+N4jmB43IiH+czE="
18+
}
19+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
5+
OUT_FILE="${SCRIPT_DIR}/sources.json"
6+
WORK_DIR=$(mktemp -d)
7+
# Auto-detect latest version from GitHub releases
8+
VERSION=$(curl -s https://api.github.com/repos/aws-cloudformation/cloudformation-languageserver/releases/latest | jq -r '.tag_name | ltrimstr("v")')
9+
10+
PLATFORMS=(
11+
"x86_64-linux:linux-x64"
12+
"aarch64-linux:linux-arm64"
13+
"x86_64-darwin:darwin-x64"
14+
"aarch64-darwin:darwin-arm64"
15+
)
16+
17+
for pair in "${PLATFORMS[@]}"; do
18+
(
19+
SYSTEM="${pair%%:*}"
20+
SUFFIX="${pair##*:}"
21+
22+
URL="https://github.com/aws-cloudformation/cloudformation-languageserver/releases/download/v${VERSION}/cloudformation-languageserver-${VERSION}-${SUFFIX}-node22.zip"
23+
24+
HASH=$(nix store prefetch-file --unpack --json "$URL" | jq -r .hash)
25+
echo "Prefetched $SYSTEM"
26+
27+
jq -n \
28+
--arg s "$SYSTEM" \
29+
--arg u "$URL" \
30+
--arg h "$HASH" \
31+
'{($s): {url: $u, sha256: $h}}' >"$WORK_DIR/$SYSTEM.json"
32+
) &
33+
done
34+
35+
wait
36+
37+
jq -n --arg v "$VERSION" '{version: $v}' >"$WORK_DIR/aaaversion.json"
38+
jq -s 'add' "$WORK_DIR"/*.json >"$OUT_FILE"
39+
40+
echo "Done! Wrote to $OUT_FILE"

0 commit comments

Comments
 (0)