writeShellApplication: use shellcheck only where supported#240348
writeShellApplication: use shellcheck only where supported#240348fgaz merged 1 commit intoNixOS:masterfrom
Conversation
6f4e4ed to
d0fe112
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2401 |
There was a problem hiding this comment.
Wouldn't it make more sense to tryEval shellcheck itself?
There was a problem hiding this comment.
I tried, but it returns true, same for non-boot ghc. I think it's because the platform support in the ghc expression is implemented with throw
There was a problem hiding this comment.
something like this
| shellcheckSupported = (builtins.tryEval ghc.bootPkgs.ghc).success; | |
| shellcheckSupported = lib.meta.availableOn stdenv.hostPlatform ghc; |
or
| shellcheckSupported = (builtins.tryEval ghc.bootPkgs.ghc).success; | |
| shellcheckSupported = lib.meta.availableOn stdenv.hostPlatform shellcheck; |
There was a problem hiding this comment.
Don't you mean buildPlatform? Also this evaluates to true. I think it's because the platform support in the ghc expression is implemented with throw
There was a problem hiding this comment.
Can we convince the ghc people to change that to meta.platforms? Maybe it is super simple because they generate many things.
There was a problem hiding this comment.
All the checks proposed here are (slightly) incorrect. That using meta.platforms is not possible is a slight oversight, namely that (shallowly) evaluating passthru (which mkDerivation needs to do) forces binDistUsed. I'll correct that separately and then it should be possible again to use meta.platforms.
The correct check for shellcheck's availability is lib.meta.availableOn stdenv.buildPlatform shellcheck.compiler which checks if the compiler we would use to build shellcheck itself is available. I need to warn you though that meta.platforms is imperfect, so there may be some edge cases, but I'm not sure if this applies to any platforms stdenv supports as a build platform. This is improved in #212188.
Edit: #246805
d0fe112 to
fed2c13
Compare
|
Ping |
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
fed2c13 to
2c5990f
Compare
sternenseemann
left a comment
There was a problem hiding this comment.
Note that the current approach will stop working after #243619. Seems like we will need to invent a completely new approach for this sort of thing then (i.e. some way to check if GHC can be bootstrapped in the context of the current package set(s)).
|
#339272 will break this. Probably no other option than using |
Description of changes
GHC (=> shellcheck) isn't supported on some platforms (such as risc-v)
but we still want to use writeShellApplication on those platforms
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)