!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

201 Members
57 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
29 Apr 2025
@c3n21:matrix.orgc3n21 *

Yes I followed the docs, and it doesn't work because fetchYarnDeps only supports yarn v1 (they have # yarn lockfile v1 as first line, which yarn berry doesn't have)

Funny enough, going the nodePackages at least allows me to build and run the package correctly, but it breaks the pipeline because generate script pulls in python2 for some reason

15:53:04
@cathal_mullan:matrix.orgCathalThe yarn.lock in the Verdaccio 6.x branch is from a yarn berry install, i.e. yarn v3/v4. Support for yarn berry just got merged last week, only hit unstable today actually: https://github.com/NixOS/nixpkgs/pull/399404 See these docs: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/javascript.section.md#yarn-berry-v3v4-javascript-yarn-v3-v415:57:13
@c3n21:matrix.orgc3n21My current attempt is already using fetchYarnBerryDeps, but it seems that with pnp it just doesn't work, I think I should report it in the PR16:30:06
@c3n21:matrix.orgc3n21* My current attempt is already using fetchYarnBerryDeps, but it seems that with pnp it just doesn't work, do you think I should report it in the PR?16:30:14
@c3n21:matrix.orgc3n21* My current attempt is already using fetchYarnBerryDeps (on my machine, not on the PR), but it seems that with pnp it just doesn't work, do you think I should report it in the PR?16:30:40
@c3n21:matrix.orgc3n21* My current attempt is already using fetchYarnBerryDeps (on my machine, not on the PR), but it seems that with pnp it just doesn't work, do you think I should report it here https://github.com/NixOS/nixpkgs/pull/399404?16:31:12
@cathal_mullan:matrix.orgCathal

Hmm, the actual fetcher seems to work fine manually for me.
e.g. this works correctly:

{
  stdenv,
  fetchFromGitHub,
  yarn-berry_3,
  nodejs,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "verdaccio";
  version = "6.1.2";

  src = fetchFromGitHub {
    owner = "verdaccio";
    repo = "verdaccio";
    rev = "v${finalAttrs.version}";
    hash = "sha256-EssvN5HtGI5Hmw4EXetj5nzrkBZAAJGgOx09dlYJzhI=";
  };

  nativeBuildInputs = [
    yarn-berry_3.yarnBerryConfigHook
    yarn-berry_3
    nodejs
  ];

  offlineCache = yarn-berry_3.fetchYarnBerryDeps {
    inherit (finalAttrs) src;
    hash = "sha256-jzkmDxQtIFMa1LIPcvKKsXIItPntgXTavoWhd5eZWyQ=";
  };

  buildPhase = ''
    yarn build
  '';

  installPhase = ''
    mkdir -p $out
    cp -r build $out
  '';
})
16:33:21
@c3n21:matrix.orgc3n21

Yes the fetcher seems to work

Try this

{
  lib,
  stdenv,
  nodejs,
  fetchFromGitHub,
  yarn-berry_3,
}:
let
  yarn-berry = yarn-berry_3;
in

stdenv.mkDerivation (finalAttrs: rec {
  pname = "verdaccio";
  version = "6.1.2";

  src = fetchFromGitHub {
    owner = "verdaccio";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-EssvN5HtGI5Hmw4EXetj5nzrkBZAAJGgOx09dlYJzhI=";
  };

  nativeBuildInputs = [
    nodejs
    yarn-berry
    yarn-berry.yarnBerryConfigHook
  ];

  offlineCache = yarn-berry.fetchYarnBerryDeps {
    inherit (finalAttrs) src;
    hash = "sha256-jzkmDxQtIFMa1LIPcvKKsXIItPntgXTavoWhd5eZWyQ=";
  };

  buildPhase = ''
    runHook preBuild
    yarn run build
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out

    cp -r {bin,build,package.json,.pnp.cjs} $out/

    runHook postInstall
  '';

  meta = with lib; {
    description = "A simple, zero-config-required local private npm registry";
    longDescription = ''
      Verdaccio is a simple, zero-config-required local private npm registry. No need for an entire database just to get started! Verdaccio comes out of the box with its own tiny database, and the ability to proxy other registries (eg. npmjs.org), caching the downloaded modules along the way. For those looking to extend their storage capabilities, Verdaccio supports various community-made plugins to hook into services such as Amazon's s3, Google Cloud Storage or create your own plugin.
    '';
    homepage = "https://verdaccio.org";
    license = licenses.mit;
  };
})

16:34:14

Show newer messages


Back to Room ListRoom Version: 6