Skip to content

Commit

Permalink
qownnotes: fix build for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Dec 9, 2024
1 parent 73b9f2d commit 3ce32de
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions pkgs/applications/office/qownnotes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ stdenv.mkDerivation {
wrapQtAppsHook
pkg-config
installShellFiles
xvfb-run
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];
] ++ lib.optionals stdenv.hostPlatform.isLinux [ xvfb-run ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];

buildInputs = [
qtbase
Expand All @@ -52,23 +51,30 @@ stdenv.mkDerivation {
"-DBUILD_WITH_SYSTEM_BOTAN=ON"
];

postInstall = ''
installShellCompletion --cmd ${appname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
--fish <(xvfb-run $out/bin/${appname} --completion fish)
installShellCompletion --cmd ${pname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
--fish <(xvfb-run $out/bin/${appname} --completion fish)
# Install shell completion on Linux (with xvfb-run)
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
installShellCompletion --cmd ${appname} \
--bash <(xvfb-run $out/bin/${appname} --completion bash) \
--fish <(xvfb-run $out/bin/${appname} --completion fish)
installShellCompletion --cmd ${pname} \
--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.hostPlatform.isLinux ''
ln -s $out/bin/${appname} $out/bin/${pname}
''
# Wrap application for macOS as lowercase binary
# Remame application for macOS as lowercase binary
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
mv $out/bin/${appname}.app $out/Applications
makeWrapper $out/Applications/${appname}.app/Contents/MacOS/${appname} $out/bin/${pname}
# Prevent "same file" error
mv $out/bin/${appname} $out/bin/${pname}.bin
mv $out/bin/${pname}.bin $out/bin/${pname}
'';

# Tests QOwnNotes using the NixOS module by launching xterm:
Expand Down

0 comments on commit 3ce32de

Please sign in to comment.