mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-16 18:03:59 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
110 lines
3.4 KiB
Nix
110 lines
3.4 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
stdenv,
|
|
fetchYarnDeps,
|
|
yarnConfigHook,
|
|
fetchFromGitHub,
|
|
typescript,
|
|
jq,
|
|
fetchpatch,
|
|
}:
|
|
let
|
|
# Instead of the build script that spectral-language-server provides (ref: https://github.com/luizcorreia/spectral-language-server/blob/master/script/vscode-spectral-build.sh), we build vscode-spectral manually.
|
|
# This is because the script must go through the network and will not work under the Nix sandbox environment.
|
|
vscodeSpectral = stdenv.mkDerivation (finalAttrs: {
|
|
pname = "vscode-spectral";
|
|
version = "1.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "stoplightio";
|
|
repo = "vscode-spectral";
|
|
rev = "v${finalAttrs.version}";
|
|
hash = "sha256-TWy+bC6qhTKDY874ORTBbvCIH8ycpmBiU8GLYxBIiAs=";
|
|
};
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
yarnLock = finalAttrs.src + "/yarn.lock";
|
|
hash = "sha256-am27A9VyFoXuOlgG9mnvNqV3Q7Bi7GJzDqqVFGDVWIA=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
typescript
|
|
jq
|
|
yarnConfigHook
|
|
];
|
|
|
|
postPatch = ''
|
|
cp server/tsconfig.json server/tsconfig.json.bak
|
|
jq '.compilerOptions += {"module": "NodeNext", "moduleResolution": "NodeNext"}' server/tsconfig.json.bak > server/tsconfig.json
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
# FIXME: vscode-spactral depends on @rollup/pluginutils, but it may have a bug that doesn't provide the type definitions for NodeNext module resolution. (ref: https://github.com/rollup/plugins/issues/1192)
|
|
# tsc detects some type errors in the code. However we ignore this because it's not a problem for the final build if server/dist is generated.
|
|
tsc -p server || true
|
|
test -d server/dist
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out
|
|
cp -R server/dist $out
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/stoplightio/vscode-spectral";
|
|
description = "VS Code extension bringing the awesome Spectral JSON/YAML linter with OpenAPI/AsyncAPI support";
|
|
license = licenses.asl20;
|
|
};
|
|
});
|
|
in
|
|
buildNpmPackage rec {
|
|
pname = "spectral-language-server";
|
|
version = "1.0.8-unstable-2023-06-06";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "luizcorreia";
|
|
repo = "spectral-language-server";
|
|
rev = "c9a7752b08e6bba937ef4f5435902afd41b6957f";
|
|
hash = "sha256-VD2aAzlCnJ6mxPUSbNRfMOlslM8kLPqrAI2ah6sX9cU=";
|
|
};
|
|
|
|
npmDepsHash = "sha256-ixAXy/rRkyWL3jdAkrXJh1qhWcKIkr5nH/Bhu2JV6k8=";
|
|
|
|
patches = [
|
|
# https://github.com/luizcorreia/spectral-language-server/pull/15
|
|
(fetchpatch {
|
|
name = "fix-package-lock.patch";
|
|
url = "https://github.com/luizcorreia/spectral-language-server/commit/909704850dd10e7b328fc7d15f8b07cdef88899d.patch";
|
|
hash = "sha256-+mN93xP4HCll4dTcnh2W/m9k3XovvgnB6AOmuJpZUZ0=";
|
|
})
|
|
];
|
|
|
|
dontNpmBuild = true;
|
|
|
|
npmFlags = [ "--ignore-scripts" ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin
|
|
mkdir -p $out/node_modules
|
|
mkdir -p $out/dist/spectral-language-server
|
|
cp -R ${vscodeSpectral}/dist/* $out/dist/spectral-language-server/
|
|
cp ./bin/* $out/bin
|
|
cp -R ./node_modules/* $out/node_modules
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/luizcorreia/spectral-language-server";
|
|
description = "Awesome Spectral JSON/YAML linter with OpenAPI/AsyncAPI support";
|
|
maintainers = with maintainers; [ momeemt ];
|
|
license = licenses.mit;
|
|
mainProgram = "spectral-language-server";
|
|
};
|
|
}
|