treewide: rewrite some uses of hostPlatform == buildPlatform to canExecute

This rewrites uses of

stdenv.hostPlatform == stdenv.buildPlatform

to

stdenv.buildPlatform.canExecute stdenv.hostPlatform

when guarding postInstall scripts that use $out/bin/… to generate shell completions
This commit is contained in:
Julius Michaelis 2024-07-11 11:54:39 +09:00
parent 6a9beaf893
commit 87e574e110
5 changed files with 8 additions and 8 deletions

View File

@ -3,8 +3,8 @@
, fetchFromGitHub
, stdenv
, installShellFiles
, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform
, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform
, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, withTcp ? true
}:

View File

@ -46,7 +46,7 @@ rustPlatform.buildRustPackage {
# to nix-daemon to import NARs, which is not possible in the build sandbox.
doCheck = false;
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
if [[ -f $out/bin/attic ]]; then
installShellCompletion --cmd attic \
--bash <($out/bin/attic gen-completions bash) \

View File

@ -5,8 +5,8 @@
, pkg-config
, darwin
, installShellFiles
, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform
, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform
, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, notmuch
, gpgme
, buildNoDefaultFeatures ? false

View File

@ -5,8 +5,8 @@
, pkg-config
, darwin
, installShellFiles
, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform
, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform
, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
, notmuch
, buildNoDefaultFeatures ? false
, buildFeatures ? []

View File

@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs";
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd colmena \
--bash <($out/bin/colmena gen-completions bash) \
--zsh <($out/bin/colmena gen-completions zsh) \