How to build nglview?

This is the content of file with which I am currently trying to build nglview for Python312:

{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchYarnDeps,
  jupyter-packaging,
  nodejs,
  yarn,
}:

let
  src = fetchFromGitHub {
    owner = "nglviewer";
    repo = "nglview";
    rev = "c3c08f617493e72c8d17b150c7758876066ac704";
    sha256 = "76FqAsJkcl20a8J8Fr9Xj3rmnIvIlmVlt65MSmY0Lqo=";
  };

  yarnDeps = fetchYarnDeps {
    yarnLock = "${src}/js/yarn.lock";
    sha256 = lib.fakeSha256; # Replace with actual hash after first attempt
  };
in
buildPythonPackage {
  pname = "nglview";
  version = "3.1.0";

  inherit src;

  nativeBuildInputs = [
    jupyter-packaging
  ];

  pythonImportsCheck = [ "nglviewer" ];
  doCheck = true;

  meta = with lib; {
    description = "Extension for colcon to support Ament Cargo packages";
    homepage = "https://colcon.readthedocs.io";
    license = licenses.asl20;
    maintainers = [ "Nikolai Morin" ];
    pythonSupports = python: python.pythonAtLeast "3.6" && python.pythonOlder "3.13";
  };
}

Das ist der Fehler, an dem ich derzeit hänge:

this derivation will be built:
  /nix/store/3yax8zclyy3gqwdy865r0d6axrz5pcb5-python3.12-nglview-3.1.0.drv
building '/nix/store/3yax8zclyy3gqwdy865r0d6axrz5pcb5-python3.12-nglview-3.1.0.drv'...
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Sourcing pypa-install-hook
Using pypaInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing python-catch-conflicts-hook.sh
Running phase: unpackPhase
unpacking source archive /nix/store/hss8fa4iw58nal5y8ssf8l11jvh3yybh-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tests/utils.py
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
Executing setuptoolsBuildPhase
Traceback (most recent call last):
  File "/build/source/nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 31, in <module>
    assert (nb_path/"index.js").exists(), "index.js not found in %s. Make sure to build the frontend assets and install the JupyterLab extension." % nb_path
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: index.js not found in /build/source/nglview/nbextension. Make sure to build the frontend assets and install the JupyterLab extension.
error: builder for '/nix/store/3yax8zclyy3gqwdy865r0d6axrz5pcb5-python3.12-nglview-3.1.0.drv' failed with exit code 1;
       last 25 log lines:
       > Sourcing setuptools-build-hook
       > Using setuptoolsBuildPhase
       > Sourcing pypa-install-hook
       > Using pypaInstallPhase
       > Sourcing python-imports-check-hook.sh
       > Using pythonImportsCheckPhase
       > Sourcing python-namespaces-hook
       > Sourcing python-catch-conflicts-hook.sh
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/hss8fa4iw58nal5y8ssf8l11jvh3yybh-source
       > source root is source
       > setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tests/utils.py
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > Executing setuptoolsBuildPhase
       > Traceback (most recent call last):
       >   File "/build/source/nix_run_setup", line 8, in <module>
       >     exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
       >   File "setup.py", line 31, in <module>
       >     assert (nb_path/"index.js").exists(), "index.js not found in %s. Make sure to build the frontend assets and install the JupyterLab extension." % nb_path
       >            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       > AssertionError: index.js not found in /build/source/nglview/nbextension. Make sure to build the frontend assets and install the JupyterLab extension.
       For full logs, run 'nix log /nix/store/3yax8zclyy3gqwdy865r0d6axrz5pcb5-python3.12-nglview-3.1.0.drv'.

I have 2 questions about this:

  • What do I have to do for my parcel to build?
  • Is there a more elegant way than entering the following each time? nix-build -E 'with import <nixpkgs> {}; python3Packages.callPackage ./nglview.nix {}' err> log.txt