about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2023-04-09 03:16:29 +0200
committerSandro Jäckel <sandro.jaeckel@sap.com>2023-04-12 17:31:52 +0200
commita23440e1ab8bd2315fa2bda994d8192a8fb33718 (patch)
tree16037b5f69d9b827ae5b8679e80f113049c0046b /pkgs/applications/networking/cluster
parenta6ab4bfac4447bd550a5d20da282881136c31c4a (diff)
stern: use can execute to generate files if possible even when cross compiling
Diffstat (limited to 'pkgs/applications/networking/cluster')
-rw-r--r--pkgs/applications/networking/cluster/stern/default.nix11
1 files changed, 4 insertions, 7 deletions
diff --git a/pkgs/applications/networking/cluster/stern/default.nix b/pkgs/applications/networking/cluster/stern/default.nix
index ca92df03fdadd..544d8264ec6ce 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