From a23440e1ab8bd2315fa2bda994d8192a8fb33718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 9 Apr 2023 03:16:29 +0200 Subject: [PATCH] stern: use can execute to generate files if possible even when cross compiling --- .../applications/networking/cluster/stern/default.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/networking/cluster/stern/default.nix b/pkgs/applications/networking/cluster/stern/default.nix index ca92df03fdad..544d8264ec6c 100644 --- a/pkgs/applications/networking/cluster/stern/default.nix +++ b/pkgs/applications/networking/cluster/stern/default.nix @@ -1,7 +1,5 @@ { stdenv, lib, buildPackages, buildGoModule, fetchFromGitHub, installShellFiles }: -let isCrossBuild = stdenv.hostPlatform != stdenv.buildPlatform; -in buildGoModule rec { pname = "stern"; version = "1.24.0"; @@ -19,12 +17,11 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; - ldflags = - [ "-s" "-w" "-X github.com/stern/stern/cmd.version=${version}" ]; + ldflags = [ "-s" "-w" "-X github.com/stern/stern/cmd.version=${version}" ]; - postInstall = - let stern = if isCrossBuild then buildPackages.stern else "$out"; - in + postInstall = let + stern = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then "$out" else buildPackages.stern; + in '' for shell in bash zsh; do ${stern}/bin/stern --completion $shell > stern.$shell