Skip to content

stdenv: generalise showPlatforms#222792

Merged
wegank merged 1 commit intoNixOS:masterfrom
wegank:platforms-hotfix
Mar 23, 2023
Merged

stdenv: generalise showPlatforms#222792
wegank merged 1 commit intoNixOS:masterfrom
wegank:platforms-hotfix

Conversation

@wegank
Copy link
Copy Markdown
Member

@wegank wegank commented Mar 23, 2023

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@wegank wegank force-pushed the platforms-hotfix branch from 89df60b to b46c97e Compare March 23, 2023 21:47
@wegank wegank removed request for edolstra and infinisil March 23, 2023 21:47
@ofborg ofborg Bot added 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 Mar 23, 2023
@wegank
Copy link
Copy Markdown
Member Author

wegank commented Mar 23, 2023

Result of nixpkgs-review pr 222792 run on aarch64-linux 1

@wegank wegank merged commit a19afd7 into NixOS:master Mar 23, 2023
@wegank wegank deleted the platforms-hotfix branch March 23, 2023 22:57
Copy link
Copy Markdown

@ghost ghost 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 still wrong.

$ NIXPKGS_ALLOW_BROKEN=1 nix-instantiate . -A pkgsStatic.systemd
error: Package ‘systemd-252.5’ in /git/nixpkgs/pkgs/os-specific/linux/systemd/default.nix:724 is only supported on `aarch64-linux armv5tel-linux armv6l-linux armv7a-linux armv7l-linux i686-linux m68k-linux microblaze-linux microblazeel-linux mipsel-linux mips64el-linux powerpc64-linux powerpc64le-linux riscv32-linux riscv64-linux s390-linux s390x-linux x86_64-linux` but not on requested ‘x86_64-linux’, refusing to evaluate.

👎

(The NIXPKGS_ALLOW_BROKEN=1 is only because the simplest counterexample, systemd, declares itself to be meta.broken on the platforms it doesn't support -- which is sort of going overboard).

Note the bolded portions:

error: Package ‘systemd-252.5’ in /git/nixpkgs/pkgs/os-specific/linux/systemd/default.nix:724 is only supported on aarch64-linux armv5tel-linux armv6l-linux armv7a-linux armv7l-linux i686-linux m68k-linux microblaze-linux microblazeel-linux mipsel-linux mips64el-linux powerpc64-linux powerpc64le-linux riscv32-linux riscv64-linux s390-linux s390x-linux x86_64-linux but not on requested x86_64-linux, refusing to evaluate.

The error message is telling the user that this package is only supported on x86_64-linux, so it's unsupported on x86_64-linux.

You cannot just lib.filter lib.systems.all and expect the result to explain the problem to the user

@wegank
Copy link
Copy Markdown
Member Author

wegank commented Mar 24, 2023

I'm not the one introducing the output of the platforms in the error message. The pull requests I made are to fix obvious problems, like breaking nixpkgs-review. There are certainly edge cases that I didn't detect, and I clearly mentioned one of them in the first PR.

@amjoseph-nixpkgs Maybe you'll want to fix this for static and cross builds, but if not, I'd suggest completely revert the commits beginning from @SuperSandro2000's.

@ghost
Copy link
Copy Markdown

ghost commented Mar 24, 2023

Proper fix: #222852

wegank pushed a commit that referenced this pull request Mar 24, 2023
See #222792 (review)

You can't just `lib.filter _ lib.systems.all` -- that throws away
important information, leading to nixpkgs disagreeing with itself
like this:

```
$ NIXPKGS_ALLOW_BROKEN=1 nix-instantiate . -A pkgsStatic.systemd
error: Package ‘systemd-252.5’ in ... is only supported on ... x86_64-linux but not on requested x86_64-linux, refusing to evaluate.
```

After:

```
$ NIXPKGS_ALLOW_BROKEN=1 nix-instantiate . -A pkgsStatic.systemd
error: Package ‘systemd-252.5’ in ... is not available on the requested hostPlatform:
         hostPlatform.config = "x86_64-unknown-linux-musl"
         package.meta.platforms = [
           "aarch64-linux"
           "armv5tel-linux"
           "armv6l-linux"
           "armv7a-linux"
           "armv7l-linux"
           "i686-linux"
           "m68k-linux"
           "microblaze-linux"
           "microblazeel-linux"
           "mipsel-linux"
           "mips64el-linux"
           "powerpc64-linux"
           "powerpc64le-linux"
           "riscv32-linux"
           "riscv64-linux"
           "s390-linux"
           "s390x-linux"
           "x86_64-linux"
         ]
         package.meta.badPlatforms = [
           {
             isStatic = true;
             parsed = { };
           }
         ]
       , refusing to evaluate.
```
@SuperSandro2000
Copy link
Copy Markdown
Member

@amjoseph-nixpkgs Maybe you'll want to fix this for static and cross builds, but if not, I'd suggest completely revert the commits beginning from @SuperSandro2000's.

I tested this with the gcc arches added to a machine when gcc.arch/march are set and there it yielded useful results. 😅

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

Labels

6.topic: stdenv Standard environment 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.

2 participants