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
slack: Return a dummy derivation on unsupported platforms #88727
Conversation
Without `--show-trace` the Slack derivation throws an error where it's not clear which package throws the error. Returning a dummy derivation with platforms set to `[]` results in a friendlier error message with a lot more context.
in { | ||
x86_64-darwin = darwin; | ||
x86_64-linux = linux; | ||
}.${system} or dummyDerivation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}.${system} or dummyDerivation | |
}.${system} or throw "No slack derivation for ${stdenv.hostPlatform.system}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not friendly enough IMO and inconsistent with how other derivations behave when trying to build for an unsupported platform.
Simply throwing an error will cause the package not to show up in nix-env -qaP
which is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say its inconsistent with how other derivations handle building for unsupported platforms. In addition to setting meta.plaforms
, throw
ing a "unsupported platform" message seems quite common:
- pkgs/applications/graphics/unigine-valley/default.nix
- pkgs/applications/misc/playonlinux/default.nix
- pkgs/development/compilers/cmucl/binary.nix
- pkgs/development/compilers/openjdk/openjfx/11.nix
- pkgs/development/compilers/openjdk/openjfx/13.nix
- pkgs/development/compilers/openjdk/8.nix
- pkgs/development/compilers/sagittarius-scheme/default.nix
- pkgs/development/libraries/xalanc/default.nix
- pkgs/development/pharo/vm/build-vm.nix
- pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix
- pkgs/games/steam/default.nix
- pkgs/games/vessel/default.nix
- pkgs/shells/powershell/default.nix
- pkgs/tools/security/enpass/default.nix
- pkgs/top-level/lua-packages.nix
There's even a x = {…}.${system} or throwSystem;
pattern used in some places:
- pkgs/applications/blockchains/mist.nix
- pkgs/applications/misc/simplenote/default.nix
- pkgs/applications/networking/instant-messengers/slack/default.nix
- pkgs/applications/networking/instant-messengers/wire-desktop/default.nix
- pkgs/development/libraries/oracle-instantclient/default.nix
- pkgs/development/tools/electron/3.x.nix
(including further up in the slack package code)
Building a dummy derivation, only for the purpose of it failing a build looks more hacky to me.
@adisbladis any further comments? I really think the way it currently is done is consistent with the rest of nixpkgs, and if we want a better error message, this should be a nixpkgs-wide (or nix-wide) improvement. |
I still don't like I do agree it's a larger issue though and should be fixed in a more consistent manner. |
Without
--show-trace
the Slack derivation throws an error where it'snot clear which package throws the error.
Returning a dummy derivation with platforms set to
[]
results in afriendlier error message with a lot more context.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)