| 18 Apr 2026 |
samasaur | yea if you want no gtk you can do openjdk.override { enableGtk = false }, or use headless which also turns off jdk | 17:43:45 |
samasaur | there's not really the traditional install-time | 17:44:46 |
Alice | well, making a derivation(?) doesn't mentally fit into either runtime nor build time to us? | 17:46:00 |
samasaur | building a derivation ~= traditional build time and install time | 17:47:45 |
samasaur | more or less | 17:47:50 |
Alice | hmm, where would that go? | 18:01:41 |
samasaur | are you referencing openjdk directly or is it a dependency of something? | 18:04:19 |
Alice | it's a gradle build | 18:04:29 |
samasaur | so the latter? | 18:05:16 |
samasaur | like in your nix config you're not ever referencing openjdk | 18:05:28 |
Alice | yes (well, in the project flake) | 18:05:55 |
samasaur | ah yeah not necessarily a config, my bad | 18:06:07 |
samasaur | in that case you'll want to override the derivation that depends on openjdk to use the overridden one | 18:06:35 |
samasaur | e.g.
hello.override {
openjdk = openjdk.override {
enableGtk = false;
};
}
| 18:07:01 |
samasaur | the 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 used | 18:07:49 |
samasaur | which has wider-ranging implications obviously but i think shoujld be fine in this case | 18:08:08 |
Alice | we just, don't want nix to pull in dependencies which are not actually required | 18:08:23 |
samasaur | is this flake public somewhere | 18:08:49 |
Alice | (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 | well, the flake itself is pretty small, so, here, | 18:11:29 |
samasaur | well that's hard to do because the flake is pure and doesn't depend on the system | 18:11:28 |
Alice | Download flake.nix | 18:11:29 |
samasaur | there's no way for the flake to know whether the system already needs openjdk with GTK | 18:11:54 |
Alice | well, we wouldn't think that that would be the job of the flake | 18:12:17 |
Alice | but 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 | that'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 reason | 18:14:59 |
samasaur | the 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 system | 18:16:43 |
msgilligan | 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 | i mean you very well could define a flake output that needs to be passed a JDK | 18:51:16 |
samasaur | it's just not the typical way things are done because then nix run, nix shell, etc. won't work | 18:51:48 |