Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why write out meta.platforms? #423

Open
doronbehar opened this issue Mar 23, 2024 · 1 comment
Open

Why write out meta.platforms? #423

doronbehar opened this issue Mar 23, 2024 · 1 comment

Comments

@doronbehar
Copy link

I find this behavior peculiar:

nix-init/src/main.rs

Lines 998 to 1004 in c6e51b1

if matches!(choice, BuildType::MkDerivation { .. }) {
if has_zig {
writeln!(out, " inherit (zig.meta) platforms;")?;
} else {
writeln!(out, " platforms = platforms.all;")?;
}
}

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants