!aRKdLCkUeIFjRPZuJT:nixos.org

NixOS JVM

136 Members
29 Servers

Load older messages


SenderMessageTime
18 Apr 2026
@alice:the-apothecary.clubAliceit's a gradle build18:04:29
@samasaur:matrix.orgsamasaurso the latter?18:05:16
@samasaur:matrix.orgsamasaur like in your nix config you're not ever referencing openjdk 18:05:28
@alice:the-apothecary.clubAliceyes (well, in the project flake)18:05:55
@samasaur:matrix.orgsamasaurah yeah not necessarily a config, my bad18:06:07
@samasaur:matrix.orgsamasaurin that case you'll want to override the derivation that depends on openjdk to use the overridden one18:06:35
@samasaur:matrix.orgsamasaur

e.g.

hello.override {
  openjdk = openjdk.override {
    enableGtk = false;
  };
}
18:07:01
@samasaur:matrix.orgsamasaurthe alternative to doing this on a case-by-case basis is to add an override to your instantiation of nixpkgs so that gtk is off for openjdk everywhere openjdk is used18:07:49
@samasaur:matrix.orgsamasaurwhich has wider-ranging implications obviously but i think shoujld be fine in this case18:08:08
@alice:the-apothecary.clubAlicewe just, don't want nix to pull in dependencies which are not actually required18:08:23
@samasaur:matrix.orgsamasauris this flake public somewhere18:08:49
@alice:the-apothecary.clubAlice (like, this flake we are making does not require gtk/graphics, but if some other thing on the system does, we don't want nix to pull openjdk and openjdk with disabled gtk 18:09:48
@alice:the-apothecary.clubAlicewell, the flake itself is pretty small, so, here,18:11:29
@samasaur:matrix.orgsamasaurwell that's hard to do because the flake is pure and doesn't depend on the system18:11:28
@alice:the-apothecary.clubAliceDownload flake.nix18:11:29
@samasaur:matrix.orgsamasaurthere's no way for the flake to know whether the system already needs openjdk with GTK18:11:54
@alice:the-apothecary.clubAlicewell, we wouldn't think that that would be the job of the flake18:12:17
@alice:the-apothecary.clubAlicebut of the system, to see that flake says "i need a jdk, of openjdk variety, optionally with gtk" and go "yeah, we have openjdk, here you go"18:13:31
@samasaur:matrix.orgsamasaurthat's the kind of thing that nix explicitly tries to avoid, because doing that inevitably runs into obscure and hard to debug errors when the jdk provided by the system isn't compatible with the package for whatever reason18:14:59
@samasaur:matrix.orgsamasaurthe nix way to do what you're trying to do would be to have users of the flake override it to use a jdk that they know they're already using on their system18:16:43
@msgilligan:matrix.orgmsgilligan It seems like there could be some kind of preprocessing step that outputs a flake configuration that meets the requirement of a single JDK that satisfies dependencies of other packages. 18:50:46
@samasaur:matrix.orgsamasauri mean you very well could define a flake output that needs to be passed a JDK18:51:16
@samasaur:matrix.orgsamasaur it's just not the typical way things are done because then nix run, nix shell, etc. won't work 18:51:48
@alice:the-apothecary.clubAlicethat's "true", but feels like, kind of a shit UX, tbqh18:52:09
@samasaur:matrix.orgsamasaur you could also define it to optionally take a JDK and fall back to pkgs.openjdk if one isn't passed 18:52:20
@samasaur:matrix.orgsamasaurbut there's an infinite number of cases like this where your dependencies are configured to build with dependencies of their own that you don't care about18:53:09
@samasaur:matrix.orgsamasaurmy recommendation would be not to bother, because a) normal gradle/openjdk will be cached on hydra and an overriden one will not; b) chances are users of your package will already have the normal (non overriden) openjdk in their nix store due to other packages; c) users who actually care about extracting every little bit of space can do the overriding themselves18:55:38
@samasaur:matrix.orgsamasaurnow if you are in a situation where you need to be this precise about dependencies due to disk usage, maybe you come to a different conclusion than i did18:56:53
@msgilligan:matrix.orgmsgilliganI wonder if something like this would help for these use-cases: https://www.socallinuxexpo.org/scale/22x/presentations/configurable-flakes19:04:59
19 Apr 2026
@rasmata:matrix.org@rasmata:matrix.org joined the room.13:08:38

Show newer messages


Back to Room ListRoom Version: 6