nixpkgs/pkgs/by-name/ya/yarn/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

59 lines
1.6 KiB
Nix

{ lib
, fetchFromGitHub
, fetchzip
, nodejs
, stdenvNoCC
, testers
, gitUpdater
, withNode ? true
}:
let
completion = fetchFromGitHub {
owner = "dsifford";
repo = "yarn-completion";
rev = "v0.17.0";
hash = "sha256-z7KPXeYPPRuaEPxgY6YqsLt9n8cSsW3n2FhOzVde1HU=";
};
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "yarn";
version = "1.22.22";
src = fetchzip {
url = "https://github.com/yarnpkg/yarn/releases/download/v${finalAttrs.version}/yarn-v${finalAttrs.version}.tar.gz";
sha256 = "sha256-kFa+kmnBerTB7fY/IvfAFy/4LWvrl9lrRHMOUdOZ+Wg=";
};
buildInputs = lib.optionals withNode [ nodejs ];
installPhase = ''
mkdir -p $out/{bin,libexec/yarn/,share/bash-completion/completions/}
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
ln -s ${completion}/yarn-completion.bash $out/share/bash-completion/completions/yarn.bash
'';
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 ];
platforms = platforms.all;
mainProgram = "yarn";
};
})