starpls: 0.1.21 -> 0.1.21 built from source (#429706)
This commit is contained in:
commit
2cbe754f69
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.1.21",
|
|
||||||
"assets": {
|
|
||||||
"x86_64-linux": {
|
|
||||||
"url": "https://github.com/withered-magic/starpls/releases/download/v0.1.21/starpls-linux-amd64",
|
|
||||||
"hash": "sha256-RWkuy52UoZoVseeyQKzf9XAveM0iGI2sQeGHnLi9zc8="
|
|
||||||
},
|
|
||||||
"aarch64-linux": {
|
|
||||||
"url": "https://github.com/withered-magic/starpls/releases/download/v0.1.21/starpls-linux-aarch64",
|
|
||||||
"hash": "sha256-SIyHNl0O4HrNtA3561Np4ROtfZbA+OwS/qjIDp4S54E="
|
|
||||||
},
|
|
||||||
"x86_64-darwin": {
|
|
||||||
"url": "https://github.com/withered-magic/starpls/releases/download/v0.1.21/starpls-darwin-amd64",
|
|
||||||
"hash": "sha256-cfAITd3t1Z9EUbgf6jyMl9xRpIUpKTN4C+zJL315AjQ="
|
|
||||||
},
|
|
||||||
"aarch64-darwin": {
|
|
||||||
"url": "https://github.com/withered-magic/starpls/releases/download/v0.1.21/starpls-darwin-arm64",
|
|
||||||
"hash": "sha256-gtcb9sFQOKHGQtzVsm0iUCcoMA5B9ZrwZDzQdiXhakc="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +1,47 @@
|
|||||||
{
|
{
|
||||||
|
rustPlatform,
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
|
||||||
fetchurl,
|
|
||||||
autoPatchelfHook,
|
|
||||||
testers,
|
testers,
|
||||||
starpls,
|
fetchFromGitHub,
|
||||||
|
protobuf,
|
||||||
}:
|
}:
|
||||||
|
rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
let
|
|
||||||
manifest = lib.importJSON ./manifest.json;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
|
||||||
pname = "starpls";
|
pname = "starpls";
|
||||||
version = manifest.version;
|
version = "0.1.21";
|
||||||
|
|
||||||
src =
|
src = fetchFromGitHub {
|
||||||
let
|
owner = "withered-magic";
|
||||||
system = stdenv.hostPlatform.system;
|
repo = "starpls";
|
||||||
in
|
# https://github.com/withered-magic/starpls/commit/96ef5d0548748745756c421960e0ebb5cfbef963
|
||||||
fetchurl (manifest.assets.${system} or (throw "Unsupported system: ${system}"));
|
rev = "96ef5d0548748745756c421960e0ebb5cfbef963";
|
||||||
|
hash = "sha256-PymdSITGeSxKwcLnsJPKc73E8VDS8SSRBRRNQSKvnbU=";
|
||||||
|
};
|
||||||
|
|
||||||
dontUnpack = true;
|
cargoHash = "sha256-yovv8ox7TtSOxGW+YKYr/ED4cq7P7T7vSqoXBFhFGb4=";
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isElf [
|
nativeBuildInputs = [
|
||||||
autoPatchelfHook
|
protobuf
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = lib.optionals stdenv.hostPlatform.isElf [
|
# The tests assume Bazel build and environment variables set like
|
||||||
(lib.getLib stdenv.cc.cc)
|
# RUNFILES_DIR which don't have an equivalent in Cargo.
|
||||||
];
|
doCheck = false;
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
install -D $src $out/bin/starpls
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests.version = testers.testVersion {
|
tests.version = testers.testVersion {
|
||||||
package = starpls;
|
package = finalAttrs.finalPackage;
|
||||||
command = "starpls version";
|
command = "starpls version";
|
||||||
version = "v${finalAttrs.version}";
|
version = "v${finalAttrs.version}";
|
||||||
};
|
};
|
||||||
updateScript = ./update.py;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Language server for Starlark";
|
description = "Language server for Starlark";
|
||||||
homepage = "https://github.com/withered-magic/starpls";
|
homepage = "https://github.com/withered-magic/starpls";
|
||||||
license = lib.licenses.asl20;
|
license = lib.licenses.asl20;
|
||||||
platforms = builtins.attrNames manifest.assets;
|
platforms = lib.platforms.all;
|
||||||
maintainers = with lib.maintainers; [ aaronjheng ];
|
maintainers = with lib.maintainers; [ aaronjheng ];
|
||||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with lib.sourceTypes; [ fromSource ];
|
||||||
mainProgram = "starpls";
|
mainProgram = "starpls";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
#!/usr/bin/env nix-shell
|
|
||||||
#! nix-shell -i python -p "python3.withPackages (ps: with ps; [ ps.httpx ps.socksio ])"
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import pathlib
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
import httpx
|
|
||||||
|
|
||||||
platforms = {
|
|
||||||
"x86_64-linux": "linux-amd64",
|
|
||||||
"aarch64-linux": "linux-aarch64",
|
|
||||||
"x86_64-darwin": "darwin-amd64",
|
|
||||||
"aarch64-darwin": "darwin-arm64",
|
|
||||||
}
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
headers = {}
|
|
||||||
token = os.getenv("GITHUB_TOKEN")
|
|
||||||
if token is not None:
|
|
||||||
headers["Authorization"] = "Bearer {}".format(token)
|
|
||||||
|
|
||||||
resp = httpx.get(
|
|
||||||
"https://api.github.com/repos/withered-magic/starpls/releases/latest",
|
|
||||||
headers=headers,
|
|
||||||
)
|
|
||||||
|
|
||||||
latest_release = resp.json().get("tag_name")
|
|
||||||
version = latest_release.removeprefix("v")
|
|
||||||
|
|
||||||
assets = {
|
|
||||||
"version": version,
|
|
||||||
"assets": {},
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v in platforms.items():
|
|
||||||
url = "https://github.com/withered-magic/starpls/releases/download/v{}/starpls-{}".format(
|
|
||||||
version, v
|
|
||||||
)
|
|
||||||
|
|
||||||
process = subprocess.run(
|
|
||||||
["nix-prefetch-url", "--type", "sha256", url],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
process.check_returncode()
|
|
||||||
|
|
||||||
process = subprocess.run(
|
|
||||||
["nix-hash", "--type", "sha256", "--to-sri", process.stdout.rstrip()],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
process.check_returncode()
|
|
||||||
|
|
||||||
hash = process.stdout.rstrip()
|
|
||||||
assets["assets"][k] = {
|
|
||||||
"url": url,
|
|
||||||
"hash": hash,
|
|
||||||
}
|
|
||||||
|
|
||||||
(pathlib.Path(__file__).parent / "manifest.json").write_text(
|
|
||||||
json.dumps(assets, indent=2) + "\n"
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user