Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 chromium, # Can be overwritten to be (potentially) any Chromium implementation
5 fetchFromGitHub,
6 fetchYarnDeps,
7 yarnConfigHook,
8 yarnBuildHook,
9 yarnInstallHook,
10 nodejs,
11 makeWrapper,
12}:
13stdenv.mkDerivation rec {
14 pname = "google-lighthouse";
15 version = "12.7.0";
16
17 src = fetchFromGitHub {
18 owner = "GoogleChrome";
19 repo = "lighthouse";
20 tag = "v${version}";
21 hash = "sha256-5YSUbqjzgBTjBtZYLwiGFWdWD9aDZ9To8kBZd09Tzkw=";
22 };
23
24 yarnOfflineCache = fetchYarnDeps {
25 yarnLock = "${src}/yarn.lock";
26 hash = "sha256-ySNsklPfhUm/RkXzAA2wlzx4jg61vL3zxlyhEBppMVE=";
27 };
28
29 yarnBuildScript = "build-report";
30
31 nativeBuildInputs = [ makeWrapper ];
32 buildInputs = [
33 yarnConfigHook
34 yarnBuildHook
35 yarnInstallHook
36 chromium
37 nodejs
38 ];
39
40 postCheck = ''
41 yarn unit
42 yarn test-clients
43 yarn test-docs
44 yarn test-treemap
45 '';
46
47 postInstall = ''
48 wrapProgram "$out/bin/lighthouse" \
49 --set CHROME_PATH ${lib.getExe chromium}
50 '';
51
52 doDist = false;
53 meta = {
54 description = "Automated auditing, performance metrics, and best practices for the web";
55 homepage = "https://developer.chrome.com/docs/lighthouse/overview";
56 license = lib.licenses.asl20;
57 mainProgram = "lighthouse";
58 maintainers = with lib.maintainers; [ theCapypara ];
59 };
60}