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

lib.meta: introduce availableOn to check package availability on given platform #114374

Merged
merged 1 commit into from
May 8, 2021

Conversation

oxalica
Copy link
Contributor

@oxalica oxalica commented Feb 25, 2021

Motivation for this change

Currently, a pattern lib.any (lib.meta.platformMatch stdenv.hostPlatform) <some_pkg>.meta.platforms is used to check whether a optional feature should be enabled by default. But it is incorrect since it doesn't check meta.badPlatforms. This made package like systemd on riscv linux have kexectools enabled, which doesn't support riscv, leading to an failure. (Related #101651)

This PR replace the pattern with a new function availableOnPlatform to check both meta.{platforms,badPlatforms}.

This PR does NOT cause any rebuilds for currently non-broken packages.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 6.topic: haskell 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: systemd 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Feb 25, 2021
@Atemu
Copy link
Member

Atemu commented Feb 28, 2021

The name is a bit long, availableOn would probably suffice.

@oxalica oxalica force-pushed the lib/platform-support-check branch from f708003 to 5232d32 Compare March 1, 2021 16:00
@oxalica
Copy link
Contributor Author

oxalica commented Mar 1, 2021

@Atemu

The name is a bit long, availableOn would probably suffice.

Renamed. Also added docs for it.

@oxalica oxalica changed the title lib.meta: introduce availableOnPlatform lib.meta: introduce availableOn to check package availability on given platform Mar 3, 2021
@r-burns r-burns added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 9, 2021
Copy link
Contributor

@r-burns r-burns left a comment

Choose a reason for hiding this comment

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

This is a big help for unbreaking risc-v, and seems useful to have in general

@oxalica oxalica force-pushed the lib/platform-support-check branch from 5232d32 to dfe77bb Compare March 9, 2021 14:11
@oxalica oxalica requested a review from r-burns March 9, 2021 14:15
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 9, 2021
@infinisil infinisil merged commit 08d94fd into NixOS:master May 8, 2021
@oxalica oxalica deleted the lib/platform-support-check branch May 8, 2021 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: haskell 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: systemd 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants