!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

201 Members
57 Servers

Load older messages


SenderMessageTime
9 Mar 2026
@scrumplex:duckhub.ioScrumplex

I took vencord from nixpkgs as an example package and swapped out the existing fetchPnpmDeps-based tooling for importPnpmLock: https://tangled.org/scrumplex.net/importPnpmLock.nix/blob/main/checks/vencord.nix

I also started to use this for some of my personal projects.

It may run into some edge cases and the interface isn't finalized, but it works great for being a PoC

20:57:58
@scrumplex:duckhub.ioScrumplex * I am currently working on importPnpmLock to support package builds without having a pnpmDeps FOD: https://tangled.org/scrumplex.net/importPnpmLock.nix This is mostly useful for projects that use dependabot or renovate where keeping pnpmDeps up-to-date is cumbersome. It is very bare bones, but should support everything pnpm has to offer due to its fundamental design: Instead of trying to be smart about it, we just use the existing mitmcache infrastructure from nixpkgs. Luckily, the pnpm lock file contains everything* we need and the only issue is that it's a YAML file, leading to IFD in my implementation. While a pnpm2nix-style script would have avoided IFD, it would have the same issues as the status quo (updating hashes). *: Git as well as tarball dependencies are not locked with the exact tarball hash. Those have to be specified manually, similar to how importCargoLock does it. 20:58:21
@rosssmyth:matrix.org@rosssmyth:matrix.orgNice! I was looking into making an IFD pnpm lockfile import23:52:30
10 Mar 2026
@amadaluzia:unredacted.orgamadaluzia joined the room.01:46:22
11 Mar 2026
@srasu:srasu.orgsrasu joined the room.01:48:34
@srasu:srasu.orgsrasu Hello! I'm trying out packaging out-of-your-element and I'm trying to figure out how to use buildNpmPackage to do so. It seems like doing that doesn't result in me being able to call the various scripts available via npm run <subcommand>, which is the primary way to interact with it. Is there a way to do that with buildNpmPackage? 01:50:35
@hexa:lossy.networkhexanone of the scripts looks like a build script02:00:15
@srasu:srasu.orgsrasu that's correct, there's no "build", it's just a collection of scripts meant to be run with npm run 02:01:08
@srasu:srasu.orgsrasu The flow I'm looking for here more or less is to be able to do a nix run .#ooye-setup to call the npm run setup command, use it interactively to produce a file, then use requireFile to provide it to another derivation that will call npm run start 02:01:28
@srasu:srasu.orgsrasuI don't know if that will be feasible02:01:54
@srasu:srasu.orgsrasuI think I figured it out for my case02:58:27
@srasu:srasu.orgsrasu I ended up needing to make my own installPhase that copied over the project to the $out and used makeWrapper to make scripts that call node to run the relevant scripts. 02:59:00
@srasu:srasu.orgsrasu
{
  lib,
  pkgs,
  buildNpmPackage,
  importNpmLock,
  nodejs ? pkgs.nodejs_22,
  ...
}:

buildNpmPackage (finalAttrs: {
  pname = "ooye";
  version = "3.4";

  src = builtins.fetchGit {
    url = https://gitdab.com/cadence/out-of-your-element/;
    rev = "c55e6c611585f4c1dbfd8c767e5f872fbeb0c66a";
    ref = "v${finalAttrs.version}";
  };

  npmDepsHash = "";

  npmDeps = importNpmLock { npmRoot = finalAttrs.src; };

  npmConfigHook = importNpmLock.npmConfigHook;
  dontNpmBuild = true;

  installPhase = ''
    runHook preInstall
    mkdir -p $out
    mkdir -p $out/bin
    cp -R . $out/source
    makeWrapper ${nodejs}/bin/node $out/bin/ooye-setup --add-flags $out/source/scripts/setup.js
    makeWrapper ${nodejs}/bin/node $out/bin/ooye --add-flags $out/source/start.js
    runHook postInstall
  '';

  npmPackFlags = [ "--ignore-scripts" ];
})
Like this
02:59:36
@benwebb:matrix.orgbenwebb joined the room.06:27:08

There are no newer messages yet.


Back to Room ListRoom Version: 6