Skip to content

Commit

Permalink
Merge pull request #302696 from marsam/yarn-without-node
Browse files Browse the repository at this point in the history
yarn: allow install without node
  • Loading branch information
marsam committed Apr 9, 2024
2 parents a76c455 + 8c29b8d commit bea21e5
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions pkgs/development/tools/yarn/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{ lib, fetchFromGitHub, fetchzip, nodejs, stdenvNoCC, testers }:
{ lib
, fetchFromGitHub
, fetchzip
, nodejs
, stdenvNoCC
, testers
, gitUpdater
, withNode ? true
}:

let
completion = fetchFromGitHub {
Expand All @@ -17,7 +25,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/}
Expand All @@ -27,15 +35,24 @@ 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;
});

updateScript = gitUpdater {
url = "https://github.com/yarnpkg/yarn.git";
rev-prefix = "v";
};
};

meta = with lib; {
description = "Fast, reliable, and secure dependency management for javascript";
homepage = "https://classic.yarnpkg.com/";
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";
};
})

0 comments on commit bea21e5

Please sign in to comment.