Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 101 lines 2.1 kB view raw
1{ 2 fetchFromGitHub, 3 git, 4 jdk_headless, 5 jre_headless, 6 makeWrapper, 7 python3, 8 stdenvNoCC, 9 lib, 10 testers, 11}: 12 13let 14 pname = "validator-nu"; 15 version = "23.4.11-unstable-2023-12-18"; 16 17 src = fetchFromGitHub { 18 owner = "validator"; 19 repo = "validator"; 20 rev = "c3a401feb6555affdc891337f5a40af238f9ac2d"; 21 fetchSubmodules = true; 22 hash = "sha256-pcA3HXduzFKzoOHhor12qvzbGSSvo3k3Bpy2MvvQlCI="; 23 }; 24 25 deps = stdenvNoCC.mkDerivation { 26 pname = "${pname}-deps"; 27 inherit version src; 28 29 nativeBuildInputs = [ 30 git 31 jdk_headless 32 python3 33 python3.pkgs.certifi 34 ]; 35 36 buildPhase = '' 37 python checker.py dldeps 38 ''; 39 40 installPhase = '' 41 mkdir "$out" 42 mv dependencies extras "$out" 43 ''; 44 45 outputHashMode = "recursive"; 46 outputHash = "sha256-LPtxpUd7LAYZHJL7elgcZOTaTgHqeqquiB9hiuajA6c="; 47 }; 48 49in 50stdenvNoCC.mkDerivation (finalAttrs: { 51 inherit pname version src; 52 53 nativeBuildInputs = [ 54 git 55 jdk_headless 56 makeWrapper 57 python3 58 ]; 59 60 postPatch = '' 61 substituteInPlace build/build.py --replace-warn \ 62 'validatorVersion = "%s.%s.%s" % (year, month, day)' \ 63 'validatorVersion = "${finalAttrs.version}"' 64 ''; 65 66 buildPhase = '' 67 ln -s '${deps}/dependencies' '${deps}/extras' . 68 JAVA_HOME='${jdk_headless}' python checker.py build 69 ''; 70 71 installPhase = '' 72 runHook preInstall 73 74 mkdir -p "$out/bin" "$out/share/java" 75 mv build/dist/vnu.jar "$out/share/java/" 76 makeWrapper "${jre_headless}/bin/java" "$out/bin/vnu" \ 77 --add-flags "-jar '$out/share/java/vnu.jar'" 78 79 runHook postInstall 80 ''; 81 82 passthru.tests.version = testers.testVersion { 83 package = finalAttrs.finalPackage; 84 }; 85 86 meta = { 87 description = "Helps you catch problems in your HTML/CSS/SVG"; 88 homepage = "https://validator.github.io/validator/"; 89 license = lib.licenses.mit; 90 maintainers = with lib.maintainers; [ 91 andersk 92 ivan 93 ]; 94 mainProgram = "vnu"; 95 platforms = lib.platforms.all; 96 sourceProvenance = with lib.sourceTypes; [ 97 binaryBytecode 98 fromSource 99 ]; 100 }; 101})