Skip to content

Commit 1ef77d2

Browse files
authored
tinymist: generate shell completion (NixOS#370033)
2 parents c5aaf46 + 5b81676 commit 1ef77d2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

pkgs/by-name/ti/tinymist/package.nix

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
lib,
3+
stdenv,
34
rustPlatform,
45
fetchFromGitHub,
6+
installShellFiles,
57
pkg-config,
68
libgit2,
79
openssl,
810
zlib,
11+
buildPackages,
912
versionCheckHook,
1013
nix-update-script,
1114
vscode-extensions,
@@ -27,7 +30,10 @@ rustPlatform.buildRustPackage rec {
2730
useFetchCargoVendor = true;
2831
cargoHash = "sha256-+Ce9qIETGFZXG4RX5GP8tpmH4fkpbPkDS1FX64NQ6/4=";
2932

30-
nativeBuildInputs = [ pkg-config ];
33+
nativeBuildInputs = [
34+
installShellFiles
35+
pkg-config
36+
];
3137

3238
buildInputs = [
3339
libgit2
@@ -59,6 +65,17 @@ rustPlatform.buildRustPackage rec {
5965
"--skip=semantic_tokens_full::tests::test"
6066
];
6167

68+
postInstall =
69+
let
70+
emulator = stdenv.hostPlatform.emulator buildPackages;
71+
in
72+
''
73+
installShellCompletion --cmd tinymist \
74+
--bash <(${emulator} $out/bin/tinymist completion bash) \
75+
--fish <(${emulator} $out/bin/tinymist completion fish) \
76+
--zsh <(${emulator} $out/bin/tinymist completion zsh)
77+
'';
78+
6279
nativeInstallCheckInputs = [
6380
versionCheckHook
6481
];

0 commit comments

Comments
 (0)