Skip to content

Commit

Permalink
pnpm: init at 9.1.1
Browse files Browse the repository at this point in the history
Signed-off-by: Sefa Eyeoglu <[email protected]>
  • Loading branch information
Scrumplex committed Jun 2, 2024
1 parent 4549773 commit 53af969
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkgs/development/tools/pnpm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ lib, callPackage }:
let
inherit (lib) mapAttrs' nameValuePair;

variants = {
"8" = {
version = "8.15.8";
hash = "sha256-aR/hdu6pqKgN8g5JdvPftEoEhBzriFY4/iomF0+B5l4=";
};
"9" = {
version = "9.1.1";
hash = "sha256-lVHoA9y3oYOf31QWFTqEQGDHvOATIYzoI0EFMlBKwQs=";
};
};

callPnpm = variant: callPackage ./generic.nix {inherit (variant) version hash;};

mkPnpm = versionSuffix: variant: nameValuePair "pnpm_${versionSuffix}" (callPnpm variant);
in
mapAttrs' mkPnpm variants
50 changes: 50 additions & 0 deletions pkgs/development/tools/pnpm/generic.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
lib,
stdenvNoCC,
fetchurl,
nodejs,
testers,
withNode ? true,

version,
hash,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "pnpm";
inherit version;

src = fetchurl {
url = "https://registry.npmjs.org/pnpm/-/pnpm-${finalAttrs.version}.tgz";
inherit hash;
};

buildInputs = lib.optionals withNode [ nodejs ];

installPhase = ''
runHook preInstall
install -d $out/{bin,libexec}
cp -R . $out/libexec/pnpm
ln -s $out/libexec/pnpm/bin/pnpm.cjs $out/bin/pnpm
ln -s $out/libexec/pnpm/bin/pnpx.cjs $out/bin/pnpx
runHook postInstall
'';

passthru = {
tests.version = lib.optionalAttrs withNode (
testers.testVersion { package = finalAttrs.finalPackage; }
);
};

meta = with lib; {
description = "Fast, disk space efficient package manager for JavaScript";
homepage = "https://pnpm.io/";
changelog = "https://github.com/pnpm/pnpm/releases/tag/v${finalAttrs.version}";
license = licenses.mit;
maintainers = with maintainers; [ Scrumplex ];
platforms = platforms.all;
mainProgram = "pnpm";
};
})
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11888,6 +11888,10 @@ with pkgs;

pngquant = callPackage ../tools/graphics/pngquant { };

inherit (callPackages ../development/tools/pnpm { })
pnpm_8 pnpm_9;
pnpm = pnpm_9;

po4a = perlPackages.Po4a;

poac = callPackage ../development/tools/poac {
Expand Down

0 comments on commit 53af969

Please sign in to comment.