Stuck on bug while trying to port OpenJFX to NixOS

So I’m trying to port OpenJFX to NixOS by adding it as an overlay to the openjdk11 package. I’ve seperated out openjdk/openjfx/default.nix into it’s own derivation and it builds as expected. I’ve also added it as an argument to openjdk/11.nix. In all-packages.nix I’ve defined openjfx = callPackage ../development/compilers/openjdk/openjfx { }; and passed it as an argument to openjdk as such:

openjdk11 =
    if stdenv.isDarwin then
      callPackage ../development/compilers/openjdk/darwin/11.nix { }
    else
      callPackage ../development/compilers/openjdk/11.nix {
        inherit (gnome2) GConf gnome_vfs openjfx;
      };

When I try to run nix-build -A openjdk11 I get an error

error: attribute 'openjfx' missing, at /home/skykanin/Documents/Projects/nixpkgs/pkgs/top-level/all-packages.nix:7673:60

complaining that the openjfx attribute is missing even though it is defined in all-packages.nix and being inherited in the openjdk11 definition as shown in the above snippet. So I don’t understand what the issue is.

Wouldn’t inherit (gnome2) openjfx mean that it’s looking for an attrpath like gnome2.openjfx? I think you just need a new line like inherit openjfx if it’s at the top level.

1 Like

You are correct, also since openjfx is at the top level it doesn’t actually need to be explicitly inherited at all. The openjdk11 package now builds. Thank you!

I had a go at this once but gave up due to the difficulty working with Gradle at that time. You may be able to learn something from it:

https://github.com/eqyiel/dotfiles/blob/1ced5108f9bf1b5ca6cd8d878f28e4c71efee9f0/nix/.config/nixpkgs/packages/openjfx/default.nix
https://github.com/eqyiel/dotfiles/blob/1ced5108f9bf1b5ca6cd8d878f28e4c71efee9f0/nix/.config/nixpkgs/packages/all-packages.nix#L57