diff options
author | adisbladis <adisbladis@gmail.com> | 2022-10-27 18:38:36 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-27 18:38:36 +1300 |
commit | 5561dcbe94708763a594c7568807c002677d71b6 (patch) | |
tree | 066ad996b4a03f58352ece063a59db070d0e376e | |
parent | 760f3801831494dda0c44b4f00926b29e39501c4 (diff) | |
parent | 53f5456f3bf2aa0a2c5bd0c724225e45f738b9f1 (diff) |
Merge pull request #197413 from devusb/sunshine
sunshine: init at 0.14.1
-rw-r--r-- | pkgs/servers/sunshine/default.nix | 112 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 114 insertions, 0 deletions
diff --git a/pkgs/servers/sunshine/default.nix b/pkgs/servers/sunshine/default.nix new file mode 100644 index 0000000000000..583192019d348 --- /dev/null +++ b/pkgs/servers/sunshine/default.nix @@ -0,0 +1,112 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, avahi +, libevdev +, libpulseaudio +, xorg +, libxcb +, openssl +, libopus +, ffmpeg-full +, boost +, pkg-config +, libdrm +, wayland +, libffi +, libcap +, mesa +, cudaSupport ? false +, cudaPackages ? {} +}: + +stdenv.mkDerivation rec { + pname = "sunshine"; + version = "0.14.1"; + + src = fetchFromGitHub { + owner = "LizardByte"; + repo = "Sunshine"; + rev = "v${version}"; + sha256 = "sha256-SB2DAOYf2izIwwRWEw2wt5L5oCDbb6YOqXw/z/PD1pQ="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ] ++ 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 + mesa + ] ++ lib.optionals cudaSupport [ + cudaPackages.cudatoolkit + ]; + + CXXFLAGS = [ + "-Wno-format-security" + ]; + CFLAGS = [ + "-Wno-format-security" + ]; + + cmakeFlags = [ + "-D" "FFMPEG_LIBRARIES=${ffmpeg-full}/lib" + "-D" "FFMPEG_INCLUDE_DIRS=${ffmpeg-full}/include" + "-D" "LIBAVCODEC_INCLUDE_DIR=${ffmpeg-full}/include" + "-D" "LIBAVCODEC_LIBRARIES=${ffmpeg-full}/lib/libavcodec.so" + "-D" "LIBAVDEVICE_INCLUDE_DIR=${ffmpeg-full}/include" + "-D" "LIBAVDEVICE_LIBRARIES=${ffmpeg-full}/lib/libavdevice.so" + "-D" "LIBAVFORMAT_INCLUDE_DIR=${ffmpeg-full}/include" + "-D" "LIBAVFORMAT_LIBRARIES=${ffmpeg-full}/lib/libavformat.so" + "-D" "LIBAVUTIL_INCLUDE_DIR=${ffmpeg-full}/include" + "-D" "LIBAVUTIL_LIBRARIES=${ffmpeg-full}/lib/libavutil.so" + "-D" "LIBSWSCALE_LIBRARIES=${ffmpeg-full}/lib/libswscale.so" + "-D" "LIBSWSCALE_INCLUDE_DIR=${ffmpeg-full}/include" + ]; + + 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' + + # fix libgbm path + substituteInPlace src/platform/linux/graphics.cpp \ + --replace 'handle = dyn::handle({ "libgbm.so.1", "libgbm.so" });' 'handle = dyn::handle({ "${mesa}/lib/libgbm.so.1", "${mesa}/lib/libgbm.so" });' + + # fix avahi path + substituteInPlace src/platform/linux/publish.cpp \ + --replace 'handle = dyn::handle({ "libavahi-client.so.3", "libavahi-client.so" });' 'handle = dyn::handle({ "${avahi}/lib/libavahi-client.so.3", "${avahi}/lib/libavahi-client.so" });' \ + --replace 'handle = dyn::handle({ "libavahi-common.so.3", "libavahi-common.so" });' 'handle = dyn::handle({ "${avahi}/lib/libavahi-common.so.3", "${avahi}/lib/libavahi-common.so" });' + ''; + + meta = with lib; { + description = "Sunshine is a Game stream host for Moonlight."; + homepage = "https://docs.lizardbyte.dev/projects/sunshine/"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ devusb ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4f3c0f9a1396c..04f6107e36b36 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37737,6 +37737,8 @@ with pkgs; stayrtr = callPackage ../servers/stayrtr {}; + sunshine = callPackage ../servers/sunshine {}; + sentencepiece = callPackage ../development/libraries/sentencepiece {}; kaf = callPackage ../development/tools/kaf { }; |