Skip to content

Commit

Permalink
#2912 nix: use hostPlatform and remove find command
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 7a4f97b commit 3081294
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ stdenv.mkDerivation {
wrapQtAppsHook
pkg-config
installShellFiles
] ++ lib.optionals stdenv.isLinux [ xvfb-run ] ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
] ++ lib.optionals stdenv.hostPlatform.isLinux [ xvfb-run ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ makeWrapper ];

buildInputs = [
qtbase
qtdeclarative
qtsvg
qtwebsockets
botan2
] ++ lib.optionals stdenv.isLinux [ qtwayland ];
] ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];

cmakeFlags = [
"-DQON_QT6_BUILD=ON"
"-DBUILD_WITH_SYSTEM_BOTAN=ON"
];

# Install shell completion on Linux (with xvfb-run)
postInstall = lib.optionalString stdenv.isLinux ''
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)
Expand All @@ -64,12 +64,11 @@ stdenv.mkDerivation {
--fish <($out/bin/${appname} --completion fish)
''
# Create a lowercase symlink for Linux
+ lib.optionalString stdenv.isLinux ''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
ln -s $out/bin/${appname} $out/bin/${pname}
''
# Remame application for macOS as lowercase binary
+ lib.optionalString stdenv.isDarwin ''
find $out
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# Prevent "same file" error
mv $out/bin/${appname} $out/bin/${pname}.bin
mv $out/bin/${pname}.bin $out/bin/${pname}
Expand Down

0 comments on commit 3081294

Please sign in to comment.