From 87e574e1103902679fc76da2714e6c7e032e8921 Mon Sep 17 00:00:00 2001 From: Julius Michaelis Date: Thu, 11 Jul 2024 11:54:39 +0900 Subject: [PATCH] treewide: rewrite some uses of hostPlatform == buildPlatform to canExecute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkgs/applications/misc/comodoro/default.nix | 4 ++-- pkgs/by-name/at/attic-client/package.nix | 2 +- pkgs/by-name/hi/himalaya/package.nix | 4 ++-- pkgs/by-name/ne/neverest/package.nix | 4 ++-- pkgs/tools/admin/colmena/default.nix | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/misc/comodoro/default.nix b/pkgs/applications/misc/comodoro/default.nix index b9fd5ea28ba9..01836f583066 100644 --- a/pkgs/applications/misc/comodoro/default.nix +++ b/pkgs/applications/misc/comodoro/default.nix @@ -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 }: diff --git a/pkgs/by-name/at/attic-client/package.nix b/pkgs/by-name/at/attic-client/package.nix index e369f4e8dd6a..6fca674f435a 100644 --- a/pkgs/by-name/at/attic-client/package.nix +++ b/pkgs/by-name/at/attic-client/package.nix @@ -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) \ diff --git a/pkgs/by-name/hi/himalaya/package.nix b/pkgs/by-name/hi/himalaya/package.nix index 590791630669..5a271432a0cc 100644 --- a/pkgs/by-name/hi/himalaya/package.nix +++ b/pkgs/by-name/hi/himalaya/package.nix @@ -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 diff --git a/pkgs/by-name/ne/neverest/package.nix b/pkgs/by-name/ne/neverest/package.nix index ec095dab0286..4b7076a8e03e 100644 --- a/pkgs/by-name/ne/neverest/package.nix +++ b/pkgs/by-name/ne/neverest/package.nix @@ -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 ? [] diff --git a/pkgs/tools/admin/colmena/default.nix b/pkgs/tools/admin/colmena/default.nix index 5c59a7b5386a..0ef27f2ee560 100644 --- a/pkgs/tools/admin/colmena/default.nix +++ b/pkgs/tools/admin/colmena/default.nix @@ -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) \