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

Respect --platforms passed into the various targets to get platform specific versions of nix packages #608

Open
aaomidi opened this issue Nov 7, 2024 · 1 comment

Comments

@aaomidi
Copy link

aaomidi commented Nov 7, 2024

Is your feature request related to a problem? Please describe.

Currently, I use rules_nixpkgs to bring in binaries that I end up consuming in different ways. For example, you can imagine me consuming a binary to create an OCI image. However, this falls for multi-arch builds.

Describe the solution you'd like

I'd like rules_nixpkgs_core to understand the --platforms flag and bring appropriate packages for me. For example, imagine I have:

nix_pkg.attr(
    attr = "mysql84",
)

If I'm on a macOS system, but provide a platform for linux x86_64, I'd like the mysql84 binary that comes in to be for linux x86_64.

Describe alternatives you've considered

Manually define the platform in nixopts. However, this comes with its own gotchas, namely that I'd have to define these packages multiple times, for each target platform I'd want to build for. This gets a bit messy.

nix_pkg.attr(
    attr = "mysql84",
    nixopts = [
        "--system", "x86_64-linux",
        "--option", "system", "x86_64-linux",
    ],
)
@aherrmann
Copy link
Member

Related to the packages part of #347

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

No branches or pull requests

2 participants