alistral: Add shell completions (#474218)

This commit is contained in:
Aleksana
2025-12-28 15:13:24 +00:00
committed by GitHub
+15
View File
@@ -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";