Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / tools / yarn / default.nix
blob33021254502096d96f2bbc4f159195d6e326f99d
1 { lib, fetchFromGitHub, fetchzip, nodejs, stdenvNoCC, testers }:
3 let
4   completion = fetchFromGitHub {
5     owner = "dsifford";
6     repo = "yarn-completion";
7     rev = "v0.17.0";
8     hash = "sha256-z7KPXeYPPRuaEPxgY6YqsLt9n8cSsW3n2FhOzVde1HU=";
9   };
11 stdenvNoCC.mkDerivation (finalAttrs: {
12   pname = "yarn";
13   version = "1.22.19";
15   src = fetchzip {
16     url = "https://github.com/yarnpkg/yarn/releases/download/v${finalAttrs.version}/yarn-v${finalAttrs.version}.tar.gz";
17     sha256 = "sha256-12wUuWH+kkqxAgVYkyhIYVtexjv8DFP9kLpFLWg+h0o=";
18   };
20   buildInputs = [ nodejs ];
22   installPhase = ''
23     mkdir -p $out/{bin,libexec/yarn/,share/bash-completion/completions/}
24     cp -R . $out/libexec/yarn
25     ln -s $out/libexec/yarn/bin/yarn.js $out/bin/yarn
26     ln -s $out/libexec/yarn/bin/yarn.js $out/bin/yarnpkg
27     ln -s ${completion}/yarn-completion.bash $out/share/bash-completion/completions/yarn.bash
28   '';
30   passthru.tests = testers.testVersion { package = finalAttrs.finalPackage; };
32   meta = with lib; {
33     description = "Fast, reliable, and secure dependency management for javascript";
34     homepage = "https://classic.yarnpkg.com/";
35     changelog = "https://github.com/yarnpkg/yarn/blob/v${finalAttrs.version}/CHANGELOG.md";
36     license = licenses.bsd2;
37     maintainers = with maintainers; [ offline screendriver marsam ];
38     platforms = nodejs.meta.platforms;
39     mainProgram = "yarn";
40   };