2023-09-29 13:27:17 +00:00
|
|
|
{ lib
|
2023-10-11 16:47:12 +00:00
|
|
|
, stdenv
|
2023-09-29 13:27:17 +00:00
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, pkg-config
|
2023-10-11 16:47:12 +00:00
|
|
|
, desktopToDarwinBundle
|
2023-09-29 13:27:17 +00:00
|
|
|
, xorg
|
2023-10-12 10:50:25 +00:00
|
|
|
, wayland
|
|
|
|
, wayland-protocols
|
|
|
|
, libxkbcommon
|
2023-09-29 13:27:17 +00:00
|
|
|
, libglvnd
|
2023-11-16 11:31:49 +00:00
|
|
|
, mpv-unwrapped
|
2023-10-11 16:47:12 +00:00
|
|
|
, darwin
|
2023-09-29 13:27:17 +00:00
|
|
|
, waylandSupport ? false
|
|
|
|
}:
|
|
|
|
|
2023-10-11 16:47:12 +00:00
|
|
|
assert waylandSupport -> stdenv.isLinux;
|
|
|
|
|
2023-09-29 13:27:17 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "supersonic" + lib.optionalString waylandSupport "-wayland";
|
2024-04-17 17:39:21 +00:00
|
|
|
version = "0.10.0";
|
2023-09-29 13:27:17 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dweymouth";
|
|
|
|
repo = "supersonic";
|
|
|
|
rev = "v${version}";
|
2024-04-17 17:39:21 +00:00
|
|
|
hash = "sha256-sleXZnJ/JPlyCMf6Js+Yym1RhtfZT7Q+qYAWLCavZFA=";
|
2023-09-29 13:27:17 +00:00
|
|
|
};
|
|
|
|
|
2024-04-17 17:39:21 +00:00
|
|
|
vendorHash = "sha256-JKihU597ZBq1VygpWB73V2m9NN/GDrquX9hNzBdszSQ=";
|
2023-09-29 13:27:17 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
copyDesktopItems
|
|
|
|
pkg-config
|
2023-10-11 16:47:12 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
desktopToDarwinBundle
|
2023-09-29 13:27:17 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# go-glfw doesn't support both X11 and Wayland in single build
|
|
|
|
tags = lib.optionals waylandSupport [ "wayland" ];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libglvnd
|
2023-11-16 11:31:49 +00:00
|
|
|
mpv-unwrapped
|
2023-10-11 16:47:12 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2023-09-29 13:27:17 +00:00
|
|
|
xorg.libXxf86vm
|
|
|
|
xorg.libX11
|
2023-10-12 10:50:25 +00:00
|
|
|
] ++ 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 [
|
2023-10-11 16:47:12 +00:00
|
|
|
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
|
2023-10-24 18:24:00 +00:00
|
|
|
darwin.apple_sdk_11_0.frameworks.MediaPlayer
|
2023-10-11 16:47:12 +00:00
|
|
|
];
|
2023-09-29 13:27:17 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for dimension in 128 256 512;do
|
|
|
|
dimensions=''${dimension}x''${dimension}
|
|
|
|
mkdir -p $out/share/icons/hicolor/$dimensions/apps
|
|
|
|
cp res/appicon-$dimension.png $out/share/icons/hicolor/$dimensions/apps/${meta.mainProgram}.png
|
|
|
|
done
|
|
|
|
'' + lib.optionalString waylandSupport ''
|
|
|
|
mv $out/bin/supersonic $out/bin/${meta.mainProgram}
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = meta.mainProgram;
|
|
|
|
exec = meta.mainProgram;
|
|
|
|
icon = meta.mainProgram;
|
|
|
|
desktopName = "Supersonic" + lib.optionalString waylandSupport " (Wayland)";
|
|
|
|
genericName = "Subsonic Client";
|
|
|
|
comment = meta.description;
|
|
|
|
type = "Application";
|
|
|
|
categories = [ "Audio" "AudioVideo" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
mainProgram = "supersonic" + lib.optionalString waylandSupport "-wayland";
|
|
|
|
description = "A lightweight cross-platform desktop client for Subsonic music servers";
|
|
|
|
homepage = "https://github.com/dweymouth/supersonic";
|
2023-10-11 16:47:12 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2023-09-29 13:27:17 +00:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ zane sochotnicky ];
|
|
|
|
};
|
|
|
|
}
|