Unverified Commit 58d98b07 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #260484 from vs49688/supersonic

supersonic: add darwin support
parents 30e70ade b869f7d9
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, makeDesktopItem
, copyDesktopItems
, pkg-config
, desktopToDarwinBundle
, xorg
, wayland
, wayland-protocols
, libxkbcommon
, libglvnd
, mpv
, glfw3
, darwin
, waylandSupport ? false
}:

assert waylandSupport -> stdenv.isLinux;

buildGoModule rec {
  pname = "supersonic" + lib.optionalString waylandSupport "-wayland";
  version = "0.5.2";
@@ -27,6 +34,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 +44,25 @@ buildGoModule rec {
  buildInputs = [
    libglvnd
    mpv
  ] ++ lib.optionals stdenv.isLinux [
    xorg.libXxf86vm
    xorg.libX11
  ] ++ (glfw3.override { inherit waylandSupport; }).buildInputs;
  ] ++ lib.optionals (stdenv.isLinux && !waylandSupport) [
    xorg.libXrandr
    xorg.libXinerama
    xorg.libXcursor
    xorg.libXi
    xorg.libXext
  ] ++ lib.optionals (stdenv.isLinux && waylandSupport) [
    wayland
    wayland-protocols
    libxkbcommon
  ] ++ 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 +91,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 ];
  };