From 1a18819d4d6e81d4644f444ee7f732958c7b8714 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 7 Apr 2024 04:20:00 +0000 Subject: [PATCH 1/2] yarn: allow to install without node --- pkgs/development/tools/yarn/default.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/yarn/default.nix b/pkgs/development/tools/yarn/default.nix index 1a9a619c7b15..605ae1cb25eb 100644 --- a/pkgs/development/tools/yarn/default.nix +++ b/pkgs/development/tools/yarn/default.nix @@ -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"; }; }) From 8c29b8d726bc0e6dbaef1c6cf0439e8af3d1d307 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 7 Apr 2024 04:20:00 +0000 Subject: [PATCH 2/2] yarn: add passthru.updateScript --- pkgs/development/tools/yarn/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/tools/yarn/default.nix b/pkgs/development/tools/yarn/default.nix index 605ae1cb25eb..9d95676ec2ce 100644 --- a/pkgs/development/tools/yarn/default.nix +++ b/pkgs/development/tools/yarn/default.nix @@ -4,6 +4,7 @@ , nodejs , stdenvNoCC , testers +, gitUpdater , withNode ? true }: @@ -38,6 +39,11 @@ stdenvNoCC.mkDerivation (finalAttrs: { 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; {