Unverified Commit d8d7e029 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

alistral: Add shell completions (#474218)

parents 623d4709 a59f4aca
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
  nix-update-script,
  pkg-config,
  openssl,
  installShellFiles,
  writableTmpDirAsHomeHook,
}:

rustPlatform.buildRustPackage (finalAttrs: {
@@ -27,6 +29,12 @@ rustPlatform.buildRustPackage (finalAttrs: {

  nativeBuildInputs = [
    pkg-config
  ]
  ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
    installShellFiles
    # When invoked in postInstall, alistral tries to write logfiles to its config dir on invocation, and fails if it can't find a writable one.
    # The config dir falls back to a directory relative to $HOME on both Darwin and Linux, so setting a writable $HOME is enough.
    writableTmpDirAsHomeHook
  ];

  buildInputs = [
@@ -38,6 +46,13 @@ rustPlatform.buildRustPackage (finalAttrs: {

  passthru.updateScript = nix-update-script { };

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd alistral \
      --bash <($out/bin/alistral --generate bash) \
      --fish <($out/bin/alistral --generate fish) \
      --zsh <($out/bin/alistral --generate zsh)
  '';

  meta = {
    homepage = "https://rustynova016.github.io/Alistral/";
    changelog = "https://github.com/RustyNova016/Alistral/blob/${finalAttrs.src.tag}/CHANGELOG.md";