qownnotes: add shell completion

This commit is contained in:
Patrizio Bekerle 2024-04-12 09:38:00 +02:00
parent eac134318b
commit 1277f7d1e1

View file

@ -14,6 +14,8 @@
, botan2
, pkg-config
, nixosTests
, installShellFiles
, xvfb-run
}:
let
@ -34,6 +36,8 @@ stdenv.mkDerivation {
qttools
wrapQtAppsHook
pkg-config
installShellFiles
xvfb-run
] ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
buildInputs = [
@ -49,9 +53,16 @@ stdenv.mkDerivation {
"USE_SYSTEM_BOTAN=1"
];
postInstall =
postInstall = ''
installShellCompletion --cmd ${appname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash --allow-multiple-instances) \
--fish <(xvfb-run $out/bin/${appname} --completion fish --allow-multiple-instances)
installShellCompletion --cmd ${pname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash --allow-multiple-instances) \
--fish <(xvfb-run $out/bin/${appname} --completion fish --allow-multiple-instances)
''
# Create a lowercase symlink for Linux
lib.optionalString stdenv.isLinux ''
+ lib.optionalString stdenv.isLinux ''
ln -s $out/bin/${appname} $out/bin/${pname}
''
# Wrap application for macOS as lowercase binary