quick-lint-js: cleanup, fix CMake 4 compatibility (#450952)

This commit is contained in:
kirillrdy
2025-10-11 19:58:30 +00:00
committed by GitHub
+34 -25
View File
@@ -5,8 +5,7 @@
lib,
ninja,
stdenv,
testers,
quick-lint-js,
versionCheckHook,
}:
let
@@ -15,10 +14,21 @@ let
src = fetchFromGitHub {
owner = "quick-lint";
repo = "quick-lint-js";
rev = version;
tag = version;
hash = "sha256-L2LCRm1Fsg+xRdPc8YmgxDnuXJo92nxs862ewzObZ3I=";
};
cmakeFlags = [
(lib.cmakeBool "QUICK_LINT_JS_ENABLE_BUILD_TOOLS" true)
# Temporary workaround for https://github.com/NixOS/nixpkgs/pull/108496#issuecomment-1192083379
(lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
# CMake 4 dropped support of versions lower than 3.5,
# versions lower than 3.10 are deprecated.
(lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10")
];
quick-lint-js-build-tools = buildPackages.stdenv.mkDerivation {
pname = "quick-lint-js-build-tools";
inherit version src;
@@ -27,13 +37,7 @@ let
cmake
ninja
];
doCheck = false;
cmakeFlags = [
"-DQUICK_LINT_JS_ENABLE_BUILD_TOOLS=ON"
# Temporary workaround for https://github.com/NixOS/nixpkgs/pull/108496#issuecomment-1192083379
"-DCMAKE_SKIP_BUILD_RPATH=ON"
];
inherit cmakeFlags;
ninjaFlags = "quick-lint-js-build-tools";
installPhase = ''
@@ -41,9 +45,11 @@ let
cmake --install . --component build-tools
runHook postInstall
'';
doCheck = false;
};
in
stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "quick-lint-js";
inherit version src;
@@ -51,27 +57,30 @@ stdenv.mkDerivation {
cmake
ninja
];
inherit cmakeFlags;
doCheck = true;
cmakeFlags = [
"-DQUICK_LINT_JS_USE_BUILD_TOOLS=${quick-lint-js-build-tools}/bin"
# Temporary workaround for https://github.com/NixOS/nixpkgs/pull/108496#issuecomment-1192083379
"-DCMAKE_SKIP_BUILD_RPATH=ON"
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru.tests = {
version = testers.testVersion { package = quick-lint-js; };
passthru = {
# Expose quick-lint-js-build-tools to nix repl as quick-lint-js.build-tools.
build-tools = quick-lint-js-build-tools;
};
meta = with lib; {
meta = {
description = "Find bugs in Javascript programs";
mainProgram = "quick-lint-js";
homepage = "https://quick-lint-js.com";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ratsclub ];
platforms = platforms.all;
downloadPage = "https://github.com/quick-lint/quick-lint-js";
changelog = "https://github.com/quick-lint/quick-lint-js/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ ratsclub ];
platforms = lib.platforms.all;
};
# Expose quick-lint-js-build-tools to nix repl as quick-lint-js.build-tools.
passthru.build-tools = quick-lint-js-build-tools;
}
})