Skip to content

Commit

Permalink
#2912 nix: try to add shell completion for macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Dec 9, 2024
1 parent 0370310 commit 726d939
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ stdenv.mkDerivation {
"-DBUILD_WITH_SYSTEM_BOTAN=ON"
];

# Install shell completion on Linux (there is no xvfb-run on macOS)
# Install shell completion on Linux (with xvfb-run)
postInstall = lib.optionalString stdenv.isLinux ''
installShellCompletion --cmd ${appname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
Expand All @@ -57,6 +57,12 @@ stdenv.mkDerivation {
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
--fish <(xvfb-run $out/bin/${appname} --completion fish)
''
# Install shell completion on macOS
+ lib.optionalString stdenv.isDarwin ''
installShellCompletion --cmd ${pname} \
--bash <($out/bin/${appname} --completion bash) \
--fish <($out/bin/${appname} --completion fish)
''
# Create a lowercase symlink for Linux
+ lib.optionalString stdenv.isLinux ''
ln -s $out/bin/${appname} $out/bin/${pname}
Expand Down

0 comments on commit 726d939

Please sign in to comment.