Skip to content

check-meta.nix: fix self-contradictory error messages#222852

Merged
wegank merged 1 commit intomasterfrom
unknown repository
Mar 24, 2023
Merged

check-meta.nix: fix self-contradictory error messages#222852
wegank merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented 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.

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.
```
@ghost ghost mentioned this pull request Mar 24, 2023
12 tasks
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Mar 24, 2023
@ghost ghost requested review from SuperSandro2000 and wegank March 24, 2023 07:25
@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 24, 2023
@wegank
Copy link
Copy Markdown
Member

wegank commented Mar 24, 2023

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

@wegank wegank merged commit d4660b4 into NixOS:master Mar 24, 2023
@wegank
Copy link
Copy Markdown
Member

wegank commented Mar 24, 2023

Thank you!

@ghost ghost deleted the pr/wegank/platforms branch March 24, 2023 08:02
@SuperSandro2000
Copy link
Copy Markdown
Member

Don't you think that the message is way to long now? Can't we compact that somewhat without losing to much information?

@ghost ghost mentioned this pull request Mar 28, 2023
12 tasks
@ghost
Copy link
Copy Markdown
Author

ghost commented Mar 28, 2023

With #223660

error: Package ‘systemd-253.1’ in /git/nixpkgs/pkgs/os-specific/linux/systemd/default.nix:743 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; } ]

Don't you think that the message is way to long now?

Only because people are using lib.systems string-lists. Encouragement to stop doing that is a good thing :)

If you use patterns then you get nice concise printouts like isStatic that explain the author's intent, rather than a flattened pile of strings from which you must decipher "what do these platforms have in common?".

@SuperSandro2000
Copy link
Copy Markdown
Member

Only because people are using lib.systems string-lists. Encouragement to stop doing that is a good thing :)

Like

platforms = lib.systems.inspect.patterns.isGnu;
?

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