yarn: allow to install without node

This commit is contained in:
Mario Rodas 2024-04-07 04:20:00 +00:00
parent 0c165dec84
commit 1a18819d4d
1 changed files with 15 additions and 4 deletions

View File

@ -1,4 +1,11 @@
{ lib, fetchFromGitHub, fetchzip, nodejs, stdenvNoCC, testers }:
{ lib
, fetchFromGitHub
, fetchzip
, nodejs
, stdenvNoCC
, testers
, withNode ? true
}:
let
completion = fetchFromGitHub {
@ -17,7 +24,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
sha256 = "sha256-kFa+kmnBerTB7fY/IvfAFy/4LWvrl9lrRHMOUdOZ+Wg=";
};
buildInputs = [ nodejs ];
buildInputs = lib.optionals withNode [ nodejs ];
installPhase = ''
mkdir -p $out/{bin,libexec/yarn/,share/bash-completion/completions/}
@ -27,7 +34,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
ln -s ${completion}/yarn-completion.bash $out/share/bash-completion/completions/yarn.bash
'';
passthru.tests = testers.testVersion { package = finalAttrs.finalPackage; };
passthru = {
tests.version = lib.optionalAttrs withNode (testers.testVersion {
package = finalAttrs.finalPackage;
});
};
meta = with lib; {
description = "Fast, reliable, and secure dependency management for javascript";
@ -35,7 +46,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
changelog = "https://github.com/yarnpkg/yarn/blob/v${finalAttrs.version}/CHANGELOG.md";
license = licenses.bsd2;
maintainers = with maintainers; [ offline screendriver marsam ];
platforms = nodejs.meta.platforms;
platforms = platforms.all;
mainProgram = "yarn";
};
})