forked from madjam002/yarnpnp2nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyarn.nix
38 lines (32 loc) · 859 Bytes
/
yarn.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ stdenv, rsync, yarn, fetchzip, nodejs }:
stdenv.mkDerivation {
name = "yarn-berry";
src = fetchzip {
url = "https://github.com/yarnpkg/berry/archive/b7f42424f6a13ffdb0bd1e7e03693ba03b8e1eda.zip";
sha256 = "sha256-sflVB/kj3KYQSfGEVr+cCCRQPcLCTbeAABDHF/qfbVI=";
};
phases = [ "getSource" "patchPhase" "build" ];
patches = [
./yarnPatches/pack-specific-project.patch
];
buildInputs = [
yarn
rsync
nodejs
];
getSource = ''
tmpDir=$PWD
mkdir -p $tmpDir/yarn
shopt -s dotglob
cp --no-preserve=mode -r $src/* $tmpDir/yarn/
cd $tmpDir/yarn
'';
build = ''
yarn build:cli
(cd packages/yarnpkg-pnp && yarn pack -o package.tgz)
mkdir -p $out/bin $out/packages
mv packages/yarnpkg-cli/bundles/yarn.js $out/bin/yarn
chmod +x $out/bin/yarn
patchShebangs $out/bin/yarn
'';
}