nix-community / nix-init

Generate Nix packages from URLs with hash prefetching, dependency inference, license detection, and more [maintainer=@figsoda]
https://discourse.nixos.org/t/25035
Mozilla Public License 2.0
789 stars 17 forks source link

Why write out meta.platforms? #423

Open doronbehar opened 3 months ago

doronbehar commented 3 months ago

I find this behavior peculiar:

https://github.com/nix-community/nix-init/blob/c6e51b1a546fa993a9806f72e47c1a8682f49b9f/src/main.rs#L998-L1004

From my understanding, by default we want to support all platforms, unless upstream explicitly states that they don't intend to support other platforms, or when it is obvious from the functionality of the program (such as when it refers to the Linux kernel for example).

Inferring the later just by getting a package's URL is too much to ask from nix-init, and if all platforms should be supported, then there should be no need to write platforms = lib.platforms.all;. Also, the inheritance of (zig.meta) platforms seems unnecessary to me because that could be evaluated as so, simply because zig's build hooks should not evaluate on platforms not supported by zig. Hence in both cases stating meta.platforms seems something nix-init should not do by itself.

AndersonTorres commented 3 months ago

I will comment here too:

Usually specialized builders like buildPythonApp set meta.platforms since Python is not present on all platforms that Nixpkgs supports (at least in theory).

Therefore, I think this field should be treated as auto-set in cases of specialized builders.