summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorMichael Thomas <michaelhthomas@outlook.com>2023-11-16 10:04:23 -0500
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-11-17 15:14:51 +0100
commit0de1f14ac047352c7c051c8261458318c9da805d (patch)
treec0030d623d58003d4a81e0d49c437b4703e385d7 /pkgs/applications
parente4df5bf73601b3fc27bc829443ece91d5b15a506 (diff)
firebird-emu: support darwin
firebird-emu supports darwin, but the derivation has not been tested on macOS.

This commit adds darwin support to the derivation, with the necessary tweaks to support building for a darwin target.
Namely, adds a workaround for https://github.com/NixOS/nixpkgs/issues/19098, and adds a missing dependency, qtquickcontrols.

Also, adds a postInstall hook which moves the MacOS .app file to the Applications/ folder in the
store, enabling proper linking to /Applications or ~/Applications and appearance in Spotlight
and Launchpad.
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/emulators/firebird-emu/default.nix28
1 files changed, 21 insertions, 7 deletions
diff --git a/pkgs/applications/emulators/firebird-emu/default.nix b/pkgs/applications/emulators/firebird-emu/default.nix
index d117a93fba4aa..9fd9901461617 100644
--- a/pkgs/applications/emulators/firebird-emu/default.nix
+++ b/pkgs/applications/emulators/firebird-emu/default.nix
@@ -1,6 +1,13 @@
-{ mkDerivation, lib, fetchFromGitHub, qmake, qtbase, qtdeclarative }:
-
-mkDerivation rec {
+{ stdenv
+, lib
+, fetchFromGitHub
+, qmake
+, qtbase
+, qtdeclarative
+, qtquickcontrols
+, wrapQtAppsHook
+}:
+stdenv.mkDerivation rec {
   pname = "firebird-emu";
   version = "1.6";
 
@@ -12,16 +19,23 @@ mkDerivation rec {
     hash = "sha256-ZptjlnOiF+hKuKYvBFJL95H5YQuR99d4biOco/MVEmE=";
   };
 
-  nativeBuildInputs = [ qmake ];
+  # work around https://github.com/NixOS/nixpkgs/issues/19098
+  env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && stdenv.isDarwin) "-fno-lto";
+
+  nativeBuildInputs = [ wrapQtAppsHook qmake ];
+
+  buildInputs = [ qtbase qtdeclarative qtquickcontrols ];
 
-  buildInputs = [ qtbase qtdeclarative ];
+  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    mkdir $out/Applications
+    mv $out/bin/${pname}.app $out/Applications/
+  '';
 
   meta = {
     homepage = "https://github.com/nspire-emus/firebird";
     description = "Third-party multi-platform emulator of the ARM-based TI-Nspireā„¢ calculators";
     license = lib.licenses.gpl3;
     maintainers = with lib.maintainers; [ pneumaticat ];
-    # Only tested on Linux, but likely possible to build on, e.g. macOS
-    platforms = lib.platforms.linux;
+    platforms = lib.platforms.unix;
   };
 }