mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
135 lines
2.7 KiB
Nix
135 lines
2.7 KiB
Nix
{
|
|
addDriverRunpath,
|
|
alsa-lib,
|
|
flite,
|
|
gamemode,
|
|
glfw3-minecraft,
|
|
jdk17,
|
|
jdk21,
|
|
jdk8,
|
|
kdePackages,
|
|
lib,
|
|
libGL,
|
|
libX11,
|
|
libXcursor,
|
|
libXext,
|
|
libXrandr,
|
|
libXxf86vm,
|
|
libjack2,
|
|
libpulseaudio,
|
|
libusb1,
|
|
mesa-demos,
|
|
openal,
|
|
pciutils,
|
|
pipewire,
|
|
prismlauncher-unwrapped,
|
|
stdenv,
|
|
symlinkJoin,
|
|
udev,
|
|
vulkan-loader,
|
|
xrandr,
|
|
|
|
additionalLibs ? [ ],
|
|
additionalPrograms ? [ ],
|
|
controllerSupport ? stdenv.hostPlatform.isLinux,
|
|
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
|
jdks ? [
|
|
jdk21
|
|
jdk17
|
|
jdk8
|
|
],
|
|
msaClientID ? null,
|
|
textToSpeechSupport ? stdenv.hostPlatform.isLinux,
|
|
}:
|
|
|
|
assert lib.assertMsg (
|
|
controllerSupport -> stdenv.hostPlatform.isLinux
|
|
) "controllerSupport only has an effect on Linux.";
|
|
|
|
assert lib.assertMsg (
|
|
textToSpeechSupport -> stdenv.hostPlatform.isLinux
|
|
) "textToSpeechSupport only has an effect on Linux.";
|
|
|
|
let
|
|
prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
|
in
|
|
|
|
symlinkJoin {
|
|
name = "prismlauncher-${prismlauncher'.version}";
|
|
|
|
paths = [ prismlauncher' ];
|
|
|
|
nativeBuildInputs = [ kdePackages.wrapQtAppsHook ];
|
|
|
|
buildInputs =
|
|
[
|
|
kdePackages.qtbase
|
|
kdePackages.qtsvg
|
|
]
|
|
++ lib.optional (
|
|
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.hostPlatform.isLinux
|
|
) kdePackages.qtwayland;
|
|
|
|
postBuild = ''
|
|
wrapQtAppsHook
|
|
'';
|
|
|
|
qtWrapperArgs =
|
|
let
|
|
runtimeLibs =
|
|
[
|
|
stdenv.cc.cc.lib
|
|
## native versions
|
|
glfw3-minecraft
|
|
openal
|
|
|
|
## openal
|
|
alsa-lib
|
|
libjack2
|
|
libpulseaudio
|
|
pipewire
|
|
|
|
## glfw
|
|
libGL
|
|
libX11
|
|
libXcursor
|
|
libXext
|
|
libXrandr
|
|
libXxf86vm
|
|
|
|
udev # oshi
|
|
|
|
vulkan-loader # VulkanMod's lwjgl
|
|
]
|
|
++ lib.optional textToSpeechSupport flite
|
|
++ lib.optional gamemodeSupport gamemode.lib
|
|
++ lib.optional controllerSupport libusb1
|
|
++ additionalLibs;
|
|
|
|
runtimePrograms = [
|
|
mesa-demos
|
|
pciutils # need lspci
|
|
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
|
] ++ additionalPrograms;
|
|
|
|
in
|
|
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
"--set LD_LIBRARY_PATH ${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
|
|
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
|
|
];
|
|
|
|
meta = {
|
|
inherit (prismlauncher'.meta)
|
|
description
|
|
longDescription
|
|
homepage
|
|
changelog
|
|
license
|
|
maintainers
|
|
mainProgram
|
|
platforms
|
|
;
|
|
};
|
|
}
|