From 900e2525d7b5793fc6df948b98727c531717875e Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Sun, 8 Dec 2024 19:39:27 +0100 Subject: [PATCH] qownnotes: fix build for macOS --- .../applications/office/qownnotes/default.nix | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/pkgs/applications/office/qownnotes/default.nix b/pkgs/applications/office/qownnotes/default.nix index 3e864b341adaa..4978de4fdb04b 100644 --- a/pkgs/applications/office/qownnotes/default.nix +++ b/pkgs/applications/office/qownnotes/default.nix @@ -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 @@ -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: