Skip to content

jdk8: disable structuredAttrs#425561

Merged
K900 merged 1 commit intoNixOS:masterfrom
K900:let-them-mine-craft-or-something
Jul 16, 2025
Merged

jdk8: disable structuredAttrs#425561
K900 merged 1 commit intoNixOS:masterfrom
K900:let-them-mine-craft-or-something

Conversation

@K900
Copy link
Contributor

@K900 K900 commented Jul 15, 2025

I don't know why this helps. I don't WANT to know why this helps. This is a horrible hack.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

I don't know why this helps. I don't WANT to know why this helps.
This is a horrible hack.
@K900 K900 requested review from emilazy and symphorien July 15, 2025 20:21
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 6.topic: java Including JDK, tooling, other languages, other VMs labels Jul 15, 2025
@symphorien
Copy link
Member

I did not build anything but fine by me.

@DoctorDalek1963
Copy link
Contributor

Both jdk8 and jdk11 build properly for me with this PR.

@K900 K900 merged commit 91e56b8 into NixOS:master Jul 16, 2025
28 of 32 checks passed
@K900
Copy link
Contributor Author

K900 commented Jul 16, 2025

Someone please root cause this..

@nullcubee nullcubee mentioned this pull request Jul 16, 2025
3 tasks
@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

Okay, I think I know what's happening... Just need to confirm something 👀 🤣

@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

Posted my root cause analysis in #425323 (comment)

@K900
Copy link
Contributor Author

K900 commented Jul 16, 2025

Well that's extremely cursed.

@dtomvan
Copy link
Contributor

dtomvan commented Jul 16, 2025

I guess we could revert this and swap the outputs around here? I guess that's only a band-aid for the quite frankly spooky postFixup code...

@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

Swapping the outputs doesn't solve the issue... The outputs array is converted by Nix to a dictionary ( 😩 )

[ "out" "jre" ] -> {"jre":"/nix/store/...","out":"/nix/store/..."}
[ "jre" "out" ] -> {"jre":"/nix/store/...","out":"/nix/store/..."}

You can confirm this with nix develop .#jdk8 and then cat $NIX_ATTRS_JSON_FILE or cat $NIX_ATTRS_SH_FILE

@dtomvan
Copy link
Contributor

dtomvan commented Jul 16, 2025

Huh. I always thought that:

(in nixpkgs)
$ nix-instantiate --json --eval -A openjdk8.outputs
["out","jre","debug"]

@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

That's true, but outputs has a special meaning when __structuredAttrs = true...

@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

By the way, I found this in the Nix manual (search for "outputs") https://nix.dev/manual/nix/2.30/development/json-guideline.html?highlight=outputs#json-guideline

@dtomvan
Copy link
Contributor

dtomvan commented Jul 16, 2025

OK, so I think it's safe to say this is actually properly documented, just not implemented correctly in nixpkgs? In that case we should probably raise an issue about that?

@limwa
Copy link
Contributor

limwa commented Jul 16, 2025

OK, so I think it's safe to say this is actually properly documented, just not implemented correctly in nixpkgs? In that case we should probably raise an issue about that?

I think it's the best approach.

There are some questions that should be answered before a global fix is proposed:

  • is getAllOutputNames supposed to return output names in order or is this something that was never guaranteed and derivations that rely on this are simply wrong and need to be fixed?
  • what is the best way to fix this? (I have some thoughts on this but I would like to hear more experienced people on this)

That and taking into consideration that a global fix would cause a mass rebuild is enough, imo, to warrant a "rfc" (idk if nixpkgs has rfcs or not) on this matter

@K900
Copy link
Contributor Author

K900 commented Jul 17, 2025

I don't think relying on output order is the way tbh. The postFixup can be fixed to not do that fairly easily, so it probably should.

@limwa
Copy link
Contributor

limwa commented Jul 17, 2025

Good point! I also found this

# Variables injected by replaceVars
#
# `$outputs` is unordered when `__structuredAttrs` is enabled,
# so we use `replaceVars` to pass in an ordered `$outputNames` array
@vars@
so this behavior is definitely not unheard of in nixpkgs.

Do you have any ideas on how to improve the postFixup hook?

@nixos-discourse
Copy link

@K900 K900 deleted the let-them-mine-craft-or-something branch July 27, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: java Including JDK, tooling, other languages, other VMs 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants