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

NixOS added as a Platform target including a pseudo target triple #2311

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

rickvanprim
Copy link
Contributor

Happy to rework this if there's a better approach. Motivation is to get rid of this hack I've been using (including in the nix_cross_compiling example):

# This seems like the best way for the Cargo generated dependencies to be
# aware of `x86_64-unknown-nixos-gnu`.
selects.config_setting_group(
    name = "x86_64-unknown-linux-gnu",
    match_any = [
        ":x86_64-unknown-linux-gnu_linux",
        ":x86_64-unknown-linux-gnu_nixos",
    ],
)

config_setting(
    name = "x86_64-unknown-linux-gnu_linux",
    constraint_values = [
        "@platforms//cpu:x86_64",
        "@platforms//os:linux",
    ],
)

config_setting(
    name = "x86_64-unknown-linux-gnu_nixos",
    constraint_values = [
        "@platforms//cpu:x86_64",
        "@platforms//os:nixos",
    ],
)

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable based on how Bazel seems to handle @platforms//os:nixos - thanks!

@illicitonion illicitonion merged commit bf04130 into bazelbuild:main Dec 11, 2023
3 checks passed
@rickvanprim rickvanprim deleted the nixos_platform branch December 11, 2023 17:44
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

Successfully merging this pull request may close these issues.

2 participants