diff --git a/pkgs/by-name/al/alistral/package.nix b/pkgs/by-name/al/alistral/package.nix index a94c8219489f..95a5cfb11253 100644 --- a/pkgs/by-name/al/alistral/package.nix +++ b/pkgs/by-name/al/alistral/package.nix @@ -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";