oxalica / rust-overlay

Pure and reproducible nix overlay of binary distributed rust toolchains
MIT License
960 stars 57 forks source link

Return target dep as flat list instead of nested list for darwin std #169

Closed jost-s closed 6 months ago

jost-s commented 6 months ago

It came out of debugging a call to overrideSDK on a x86_64-darwin system on the Nix discourse, that the rust-overlay returns a nested list with libiconv as the only element. That caused the override to fail.

lib.optional takes any value and puts it into a list when the condition is met. In this case the value is wrapped in a list, so the result is a nested list.

nix-repl> legacyPackages.aarch64-darwin.lib.optional true ""                                       
[ "" ]

nix-repl> legacyPackages.aarch64-darwin.lib.optional true [""]
[ [ ... ] ]

I suggest to return a flat list instead, as is done a few lines up in the same file.

jost-s commented 6 months ago

overrideSDK will be patched to handle the special case of a nested list anyway. https://github.com/NixOS/nixpkgs/pull/314167

oxalica commented 6 months ago

Thanks for the catch!