mastodon: 4.3.1 -> 4.3.2 (#361487)
[NixPkgs.git] / pkgs / by-name / ve / vercel-pkg / package.nix
blobc27d6699ed71d3e41ae88ec72b614206474bbf10
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchYarnDeps
5 , makeWrapper
6 , nodejs
7 , fixup-yarn-lock
8 , yarn
9 }:
11 stdenv.mkDerivation rec {
12   pname = "pkg";
13   version = "5.8.1";
15   src = fetchFromGitHub {
16     owner = "vercel";
17     repo = "pkg";
18     rev = version;
19     hash = "sha256-h3rHR3JE9hVcd3oiE7VL2daYXGTQo7NcOHGC6pmE/xs=";
20   };
22   offlineCache = fetchYarnDeps {
23     yarnLock = "${src}/yarn.lock";
24     hash = "sha256-KesP3X7LwZ7KSIxcCPXdn/sWcX9TJlwT9z/SdotS2ZQ=";
25   };
27   nativeBuildInputs  = [
28     makeWrapper
29     nodejs
30     fixup-yarn-lock
31     yarn
32   ];
34   configurePhase = ''
35     runHook preConfigure
37     export HOME=$(mktemp -d)
38     yarn config --offline set yarn-offline-mirror "$offlineCache"
39     fixup-yarn-lock yarn.lock
40     yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
41     patchShebangs node_modules
43     runHook postConfigure
44   '';
46   buildPhase = ''
47     runHook preBuild
49     yarn --offline prepare
51     runHook postBuild
52   '';
54   installPhase = ''
55     runHook preInstall
57     yarn --offline --production install
59     mkdir -p "$out/lib/node_modules/pkg"
60     cp -r . "$out/lib/node_modules/pkg"
62     makeWrapper "${nodejs}/bin/node" "$out/bin/pkg" \
63       --add-flags "$out/lib/node_modules/pkg/lib-es5/bin.js"
65     runHook postInstall
66   '';
68   meta = {
69     description = "Package your Node.js project into an executable";
70     homepage = "https://github.com/vercel/pkg";
71     license = lib.licenses.mit;
72     mainProgram = "pkg";
73     maintainers = with lib.maintainers; [ cmcdragonkai ];
74     platforms = lib.platforms.all;
75   };