2022-10-23 02:14:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-12-22 00:17:52 +00:00
|
|
|
, autoPatchelfHook
|
|
|
|
, buildNpmPackage
|
2022-10-23 02:14:57 +00:00
|
|
|
, cmake
|
|
|
|
, avahi
|
|
|
|
, libevdev
|
|
|
|
, libpulseaudio
|
|
|
|
, xorg
|
|
|
|
, libxcb
|
|
|
|
, openssl
|
|
|
|
, libopus
|
|
|
|
, ffmpeg-full
|
|
|
|
, boost
|
|
|
|
, pkg-config
|
|
|
|
, libdrm
|
|
|
|
, wayland
|
|
|
|
, libffi
|
|
|
|
, libcap
|
|
|
|
, mesa
|
2022-12-22 00:17:52 +00:00
|
|
|
, curl
|
|
|
|
, libva
|
|
|
|
, libvdpau
|
|
|
|
, numactl
|
2022-10-23 02:14:57 +00:00
|
|
|
, cudaSupport ? false
|
|
|
|
, cudaPackages ? {}
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sunshine";
|
2022-12-22 00:17:52 +00:00
|
|
|
version = "0.16.0";
|
2022-10-23 02:14:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "LizardByte";
|
|
|
|
repo = "Sunshine";
|
|
|
|
rev = "v${version}";
|
2022-12-22 00:17:52 +00:00
|
|
|
sha256 = "sha256-o489IPza1iLoe74Onn2grP5oeNy0ZYdrvBoMEWlbwCE=";
|
2022-10-23 02:14:57 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2022-12-22 00:17:52 +00:00
|
|
|
# remove pre-built ffmpeg; use ffmpeg from nixpkgs
|
|
|
|
patches = [ ./ffmpeg.diff ];
|
|
|
|
|
|
|
|
# fetch node_modules needed for webui
|
|
|
|
ui = buildNpmPackage {
|
|
|
|
inherit src version;
|
|
|
|
pname = "sunshine-ui";
|
|
|
|
sourceRoot = "source/src_assets/common/assets/web";
|
|
|
|
npmDepsHash = "sha256-fg/turcpPMHUs6GBwSoJl4Pxua/lGfCA1RzT1R5q53M=";
|
|
|
|
|
|
|
|
dontNpmBuild = true;
|
|
|
|
|
|
|
|
# use generated package-lock.json upstream does not provide one
|
|
|
|
postPatch = ''
|
|
|
|
cp ${./package-lock.json} ./package-lock.json
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r node_modules $out/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-10-23 02:14:57 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
2022-12-22 00:17:52 +00:00
|
|
|
autoPatchelfHook
|
2022-10-23 02:14:57 +00:00
|
|
|
] ++ lib.optionals cudaSupport [
|
|
|
|
cudaPackages.autoAddOpenGLRunpathHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
avahi
|
|
|
|
ffmpeg-full
|
|
|
|
libevdev
|
|
|
|
libpulseaudio
|
|
|
|
xorg.libX11
|
|
|
|
libxcb
|
|
|
|
xorg.libXfixes
|
|
|
|
xorg.libXrandr
|
|
|
|
xorg.libXtst
|
|
|
|
openssl
|
|
|
|
libopus
|
|
|
|
boost
|
|
|
|
libdrm
|
|
|
|
wayland
|
|
|
|
libffi
|
|
|
|
libevdev
|
|
|
|
libcap
|
|
|
|
libdrm
|
2022-12-22 00:17:52 +00:00
|
|
|
curl
|
|
|
|
libva
|
|
|
|
libvdpau
|
|
|
|
numactl
|
2022-10-23 02:14:57 +00:00
|
|
|
mesa
|
|
|
|
] ++ lib.optionals cudaSupport [
|
|
|
|
cudaPackages.cudatoolkit
|
|
|
|
];
|
|
|
|
|
2022-12-22 00:17:52 +00:00
|
|
|
runtimeDependencies = [
|
|
|
|
avahi
|
|
|
|
mesa
|
|
|
|
xorg.libXrandr
|
|
|
|
libxcb
|
|
|
|
];
|
|
|
|
|
2022-10-23 02:14:57 +00:00
|
|
|
CXXFLAGS = [
|
|
|
|
"-Wno-format-security"
|
|
|
|
];
|
|
|
|
CFLAGS = [
|
|
|
|
"-Wno-format-security"
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2022-12-22 00:17:52 +00:00
|
|
|
"-Wno-dev"
|
2022-10-23 02:14:57 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Don't force the need for a static boost, fix hardcoded libevdev path
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace 'set(Boost_USE_STATIC_LIBS ON)' '# set(Boost_USE_STATIC_LIBS ON)' \
|
|
|
|
--replace '/usr/include/libevdev-1.0' '${libevdev}/include/libevdev-1.0'
|
2022-12-22 00:17:52 +00:00
|
|
|
'';
|
2022-10-23 02:14:57 +00:00
|
|
|
|
2022-12-22 00:17:52 +00:00
|
|
|
preBuild = ''
|
|
|
|
# copy node_modules where they can be picked up by build
|
|
|
|
mkdir -p ../src_assets/common/assets/web/node_modules
|
|
|
|
cp -r ${ui}/node_modules/* ../src_assets/common/assets/web/node_modules
|
2022-10-23 02:14:57 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Sunshine is a Game stream host for Moonlight.";
|
2022-12-22 00:17:52 +00:00
|
|
|
homepage = "https://github.com/LizardByte/Sunshine";
|
2022-10-23 02:14:57 +00:00
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ devusb ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|