From cf2c289cbd5552c964a9817ff670e7d1219dc1ce Mon Sep 17 00:00:00 2001 From: Zane van Iperen Date: Thu, 12 Oct 2023 02:47:12 +1000 Subject: [PATCH] supersonic: add darwin support --- pkgs/by-name/su/supersonic/package.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/su/supersonic/package.nix b/pkgs/by-name/su/supersonic/package.nix index 0c2f34cf5fee..9de886758526 100644 --- a/pkgs/by-name/su/supersonic/package.nix +++ b/pkgs/by-name/su/supersonic/package.nix @@ -1,16 +1,21 @@ { lib +, stdenv , buildGoModule , fetchFromGitHub , makeDesktopItem , copyDesktopItems , pkg-config +, desktopToDarwinBundle , xorg , libglvnd , mpv , glfw3 +, darwin , waylandSupport ? false }: +assert waylandSupport -> stdenv.isLinux; + buildGoModule rec { pname = "supersonic" + lib.optionalString waylandSupport "-wayland"; version = "0.5.2"; @@ -27,6 +32,8 @@ buildGoModule rec { nativeBuildInputs = [ copyDesktopItems pkg-config + ] ++ lib.optionals stdenv.isDarwin [ + desktopToDarwinBundle ]; # go-glfw doesn't support both X11 and Wayland in single build @@ -35,9 +42,18 @@ buildGoModule rec { buildInputs = [ libglvnd mpv + ] ++ lib.optionals stdenv.isLinux [ xorg.libXxf86vm xorg.libX11 - ] ++ (glfw3.override { inherit waylandSupport; }).buildInputs; + ] + ++ (builtins.filter (p: !(lib.hasPrefix "apple-framework" p.name)) + (glfw3.override { inherit waylandSupport; }).buildInputs) + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk_11_0.frameworks.Cocoa + darwin.apple_sdk_11_0.frameworks.Kernel + darwin.apple_sdk_11_0.frameworks.OpenGL + darwin.apple_sdk_11_0.frameworks.UserNotifications + ]; postInstall = '' for dimension in 128 256 512;do @@ -66,7 +82,7 @@ buildGoModule rec { mainProgram = "supersonic" + lib.optionalString waylandSupport "-wayland"; description = "A lightweight cross-platform desktop client for Subsonic music servers"; homepage = "https://github.com/dweymouth/supersonic"; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; license = licenses.gpl3Plus; maintainers = with maintainers; [ zane sochotnicky ]; };