lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 24.11-pre 208 lines 4.3 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, autoPatchelfHook 5, autoAddDriverRunpath 6, makeWrapper 7, buildNpmPackage 8, nixosTests 9, cmake 10, avahi 11, libevdev 12, libpulseaudio 13, xorg 14, libxcb 15, openssl 16, libopus 17, boost 18, pkg-config 19, libdrm 20, wayland 21, libffi 22, libcap 23, mesa 24, curl 25, pcre 26, pcre2 27, python3 28, libuuid 29, libselinux 30, libsepol 31, libthai 32, libdatrie 33, libxkbcommon 34, libepoxy 35, libva 36, libvdpau 37, libglvnd 38, numactl 39, amf-headers 40, intel-media-sdk 41, svt-av1 42, vulkan-loader 43, libappindicator 44, libnotify 45, miniupnpc 46, config 47, cudaSupport ? config.cudaSupport 48, cudaPackages ? { } 49}: 50let 51 stdenv' = if cudaSupport then cudaPackages.backendStdenv else stdenv; 52in 53stdenv'.mkDerivation rec { 54 pname = "sunshine"; 55 version = "0.23.1"; 56 57 src = fetchFromGitHub { 58 owner = "LizardByte"; 59 repo = "Sunshine"; 60 rev = "v${version}"; 61 sha256 = "sha256-D5ee5m2ZTKVqZDH07nzJuFEbZBQ4xW7m4nYnJQe0EaA="; 62 fetchSubmodules = true; 63 }; 64 65 # build webui 66 ui = buildNpmPackage { 67 inherit src version; 68 pname = "sunshine-ui"; 69 npmDepsHash = "sha256-9FuMtxTwrU9UIhZXQn/tmGN0IHZBdunV0cY/EElj4bA="; 70 71 # use generated package-lock.json as upstream does not provide one 72 postPatch = '' 73 cp ${./package-lock.json} ./package-lock.json 74 ''; 75 76 installPhase = '' 77 mkdir -p $out 78 cp -r * $out/ 79 ''; 80 }; 81 82 nativeBuildInputs = [ 83 cmake 84 pkg-config 85 python3 86 makeWrapper 87 # Avoid fighting upstream's usage of vendored ffmpeg libraries 88 autoPatchelfHook 89 ] ++ lib.optionals cudaSupport [ 90 autoAddDriverRunpath 91 ]; 92 93 buildInputs = [ 94 avahi 95 libevdev 96 libpulseaudio 97 xorg.libX11 98 libxcb 99 xorg.libXfixes 100 xorg.libXrandr 101 xorg.libXtst 102 xorg.libXi 103 openssl 104 libopus 105 boost 106 libdrm 107 wayland 108 libffi 109 libevdev 110 libcap 111 libdrm 112 curl 113 pcre 114 pcre2 115 libuuid 116 libselinux 117 libsepol 118 libthai 119 libdatrie 120 xorg.libXdmcp 121 libxkbcommon 122 libepoxy 123 libva 124 libvdpau 125 numactl 126 mesa 127 amf-headers 128 svt-av1 129 libappindicator 130 libnotify 131 miniupnpc 132 ] ++ lib.optionals cudaSupport [ 133 cudaPackages.cudatoolkit 134 ] ++ lib.optionals stdenv.isx86_64 [ 135 intel-media-sdk 136 ]; 137 138 runtimeDependencies = [ 139 avahi 140 mesa 141 xorg.libXrandr 142 libxcb 143 libglvnd 144 ]; 145 146 cmakeFlags = [ 147 "-Wno-dev" 148 # upstream tries to use systemd and udev packages to find these directories in FHS; set the paths explicitly instead 149 (lib.cmakeFeature "UDEV_RULES_INSTALL_DIR" "lib/udev/rules.d") 150 (lib.cmakeFeature "SYSTEMD_USER_UNIT_INSTALL_DIR" "lib/systemd/user") 151 ]; 152 153 postPatch = '' 154 # remove upstream dependency on systemd and udev 155 substituteInPlace cmake/packaging/linux.cmake \ 156 --replace-fail 'find_package(Systemd)' "" \ 157 --replace-fail 'find_package(Udev)' "" 158 159 substituteInPlace packaging/linux/sunshine.desktop \ 160 --subst-var-by PROJECT_NAME 'Sunshine' \ 161 --subst-var-by PROJECT_DESCRIPTION 'Self-hosted game stream host for Moonlight' \ 162 --replace-fail '/usr/bin/env systemctl start --u sunshine' 'sunshine' 163 164 substituteInPlace packaging/linux/sunshine.service.in \ 165 --subst-var-by PROJECT_DESCRIPTION 'Self-hosted game stream host for Moonlight' \ 166 --subst-var-by SUNSHINE_EXECUTABLE_PATH $out/bin/sunshine 167 ''; 168 169 preBuild = '' 170 # copy webui where it can be picked up by build 171 cp -r ${ui}/build ../ 172 ''; 173 174 buildFlags = [ 175 "sunshine" 176 ]; 177 178 # allow Sunshine to find libvulkan 179 postFixup = lib.optionalString cudaSupport '' 180 wrapProgram $out/bin/sunshine \ 181 --set LD_LIBRARY_PATH ${lib.makeLibraryPath [ vulkan-loader ]} 182 ''; 183 184 # redefine installPhase to avoid attempt to build webui 185 installPhase = '' 186 runHook preInstall 187 cmake --install . 188 runHook postInstall 189 ''; 190 191 postInstall = '' 192 install -Dm644 ../packaging/linux/${pname}.desktop $out/share/applications/${pname}.desktop 193 ''; 194 195 passthru = { 196 tests.sunshine = nixosTests.sunshine; 197 updateScript = ./updater.sh; 198 }; 199 200 meta = with lib; { 201 description = "Sunshine is a Game stream host for Moonlight"; 202 homepage = "https://github.com/LizardByte/Sunshine"; 203 license = licenses.gpl3Only; 204 mainProgram = "sunshine"; 205 maintainers = with maintainers; [ devusb ]; 206 platforms = platforms.linux; 207 }; 208}