nixpkgs/pkgs/by-name/su/supersonic/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

100 lines
2.7 KiB
Nix
Raw Normal View History

{ lib
2023-10-11 18:47:12 +02:00
, stdenv
, buildGoModule
, fetchFromGitHub
, makeDesktopItem
, copyDesktopItems
, pkg-config
2023-10-11 18:47:12 +02:00
, desktopToDarwinBundle
, xorg
2023-10-12 12:50:25 +02:00
, wayland
, wayland-protocols
, libxkbcommon
, libglvnd
, mpv-unwrapped
2023-10-11 18:47:12 +02:00
, darwin
, waylandSupport ? false
}:
2023-10-11 18:47:12 +02:00
assert waylandSupport -> stdenv.isLinux;
buildGoModule rec {
pname = "supersonic" + lib.optionalString waylandSupport "-wayland";
version = "0.10.1";
src = fetchFromGitHub {
owner = "dweymouth";
repo = "supersonic";
rev = "v${version}";
hash = "sha256-0MbR6ah3UakLn/6Mfd156BlTZe7thNK6mAPLTuz298g=";
};
vendorHash = "sha256-Ld1j/SFq5W+SKppAzk7UV74RD6/Dw+PWk0BhEGML5+k=";
nativeBuildInputs = [
copyDesktopItems
pkg-config
2023-10-11 18:47:12 +02:00
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
# go-glfw doesn't support both X11 and Wayland in single build
tags = lib.optionals waylandSupport [ "wayland" ];
buildInputs = [
libglvnd
mpv-unwrapped
2023-10-11 18:47:12 +02:00
] ++ lib.optionals stdenv.isLinux [
xorg.libXxf86vm
xorg.libX11
2023-10-12 12:50:25 +02: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 18:47:12 +02: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
darwin.apple_sdk_11_0.frameworks.MediaPlayer
2023-10-11 18:47:12 +02: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 18:47:12 +02:00
platforms = platforms.linux ++ platforms.darwin;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ zane sochotnicky ];
};
}