Unverified Commit 521a910a authored by Stefan Frijters's avatar Stefan Frijters
Browse files

kubevela: use writableTmpDirAsHomeHook

parent 2bf28837
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -2,13 +2,16 @@
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  writableTmpDirAsHomeHook,
  lib,
  stdenv,
  testers,
  kubevela,
  nix-update-script,
}:

let
  canGenerateShellCompletions = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
buildGoModule (finalAttrs: {
  pname = "kubevela";
  version = "1.10.6";
@@ -30,11 +33,7 @@ buildGoModule (finalAttrs: {

  subPackages = [ "references/cmd/cli" ];

  env = {
    CGO_ENABLED = 0;
    # Workaround for permission issue in shell completion
    HOME = "$TMPDIR";
  };
  env.CGO_ENABLED = 0;

  installPhase = ''
    runHook preInstall
@@ -42,8 +41,14 @@ buildGoModule (finalAttrs: {
    runHook postInstall
  '';

  nativeBuildInputs = [ installShellFiles ];
  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
  nativeBuildInputs = [
    installShellFiles
  ]
  ++ lib.optionals canGenerateShellCompletions [
    writableTmpDirAsHomeHook # Workaround for permission issue in shell completion
  ];

  postInstall = lib.optionalString canGenerateShellCompletions ''
    installShellCompletion --cmd vela \
      --bash <($out/bin/vela completion bash) \
      --zsh <($out/bin/vela completion zsh)