Missing runtime dependencies of custom derivation

Hi there!

I copied the content of the jabref derivation into the file jabref-24.05.nix.

Then I tried to run it inside nix-shell. However, the graphical application does not show up due to missing runtime dependencies.

Here is my shell.nix file:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  buildInputs = [ (pkgs.callPackage ./jabref-24.05.nix {}) ];
}

Error messages from running nix-shell shell-24.05.nix --run jabref:

Messages are not initialized before accessing key: Display help on command line options
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/yoda/.openjfx/cache/22+30/amd64/libprism_es2.so: libXxf86vm.so.1: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: /home/yoda/.openjfx/cache/22+30/amd64/libprism_es2.so: libXxf86vm.so.1: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        ...
Loading library glassgtk3 from resource failed: java.lang.UnsatisfiedLinkError: /home/yoda/.openjfx/cache/22+30/amd64/libglassgtk3.so: libXtst.so.6: cannot open shared object file: No such file or directory
...

I don’t understand why this is the case. When I run nix-shell -p jabref --run jabref I don’t see this errors and the graphical application opens up.

Shouldn’t both built derivations (the one in nixpkgs and my locally built one) be identical as I copied the unmodified source file of the jabref derivation?

I found the solution in pkgs/top-level/all-packages.nix: There callPackage is called with the following attributes:

  jabref = callPackage ../applications/office/jabref {
    jdk = jdk.override {
      enableJavaFX = true;
      openjfx = openjfx22.override { withWebKit = true; };
    };
  };

Adding these solved my issue.

Furthermore I replaced buildInputs with packages as I think this matches the behavior of nix-shell -p ... more closely.