Skip to content

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
@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