Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qownnotes: fix build for macOS #363327

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
# Rename 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
Loading