supersonic: add darwin support

This commit is contained in:
Zane van Iperen 2023-10-12 02:47:12 +10:00 committed by Weijia Wang
parent 80f067f49a
commit cf2c289cbd

View File

@ -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 ];
};