2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchzip
|
|
|
|
, nodejs
|
|
|
|
, stdenvNoCC
|
|
|
|
, testers
|
|
|
|
, gitUpdater
|
|
|
|
, withNode ? true
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
let
|
|
|
|
completion = fetchFromGitHub {
|
|
|
|
owner = "dsifford";
|
|
|
|
repo = "yarn-completion";
|
|
|
|
rev = "v0.17.0";
|
|
|
|
hash = "sha256-z7KPXeYPPRuaEPxgY6YqsLt9n8cSsW3n2FhOzVde1HU=";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "yarn";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.22.22";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
2023-02-02 18:25:31 +00:00
|
|
|
url = "https://github.com/yarnpkg/yarn/releases/download/v${finalAttrs.version}/yarn-v${finalAttrs.version}.tar.gz";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-kFa+kmnBerTB7fY/IvfAFy/4LWvrl9lrRHMOUdOZ+Wg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
buildInputs = lib.optionals withNode [ nodejs ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2023-02-02 18:25:31 +00:00
|
|
|
mkdir -p $out/{bin,libexec/yarn/,share/bash-completion/completions/}
|
2020-04-24 23:36:52 +00:00
|
|
|
cp -R . $out/libexec/yarn
|
|
|
|
ln -s $out/libexec/yarn/bin/yarn.js $out/bin/yarn
|
|
|
|
ln -s $out/libexec/yarn/bin/yarn.js $out/bin/yarnpkg
|
2023-02-02 18:25:31 +00:00
|
|
|
ln -s ${completion}/yarn-completion.bash $out/share/bash-completion/completions/yarn.bash
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = lib.optionalAttrs withNode (testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
});
|
|
|
|
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
url = "https://github.com/yarnpkg/yarn.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Fast, reliable, and secure dependency management for javascript";
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://classic.yarnpkg.com/";
|
|
|
|
changelog = "https://github.com/yarnpkg/yarn/blob/v${finalAttrs.version}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd2;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ offline screendriver marsam ];
|
2024-04-21 15:54:59 +00:00
|
|
|
platforms = platforms.all;
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "yarn";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
})
|