chore(nix): sync with upstream Prism Launcher
This commit is contained in:
parent
7b5a2baa36
commit
a5bca15d46
43
flake.nix
43
flake.nix
@ -2,7 +2,7 @@
|
||||
description = "Prism Launcher fork with support for alternative auth servers";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://unmojang.cachix.org" ];
|
||||
extra-substituters = ["https://unmojang.cachix.org"];
|
||||
extra-trusted-public-keys = [
|
||||
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
|
||||
];
|
||||
@ -39,15 +39,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
libnbtplusplus,
|
||||
nix-filter,
|
||||
...
|
||||
}:
|
||||
let
|
||||
}: let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
# While we only officially support aarch and x86_64 on Linux and MacOS,
|
||||
@ -57,24 +55,20 @@
|
||||
|
||||
forAllSystems = lib.genAttrs systems;
|
||||
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
in
|
||||
{
|
||||
in {
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
let
|
||||
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
|
||||
system: let
|
||||
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;};
|
||||
in
|
||||
lib.filterAttrs (_: lib.isDerivation) checks'
|
||||
);
|
||||
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
system: let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
in
|
||||
{
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.fjordlauncher-unwrapped ];
|
||||
inputsFrom = [self.packages.${system}.fjordlauncher-unwrapped];
|
||||
buildInputs = with pkgs; [
|
||||
ccache
|
||||
ninja
|
||||
@ -85,27 +79,20 @@
|
||||
|
||||
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
||||
|
||||
overlays.default =
|
||||
final: prev:
|
||||
let
|
||||
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
fjordlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
|
||||
inherit
|
||||
libnbtplusplus
|
||||
nix-filter
|
||||
self
|
||||
version
|
||||
;
|
||||
};
|
||||
|
||||
fjordlauncher = final.callPackage ./nix/wrapper.nix { };
|
||||
fjordlauncher = final.callPackage ./nix/wrapper.nix {};
|
||||
};
|
||||
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
system: let
|
||||
pkgs = nixpkgsFor.${system};
|
||||
|
||||
# Build a scope from our overlay
|
||||
@ -123,12 +110,10 @@
|
||||
|
||||
# We put these under legacyPackages as they are meant for CI, not end user consumption
|
||||
legacyPackages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
system: let
|
||||
fjordPackages = self.packages.${system};
|
||||
legacyPackages = self.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
in {
|
||||
fjordlauncher-debug = fjordPackages.fjordlauncher.override {
|
||||
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
|
||||
};
|
||||
|
@ -3,12 +3,13 @@
|
||||
stdenv,
|
||||
cmake,
|
||||
cmark,
|
||||
darwin,
|
||||
apple-sdk_11,
|
||||
extra-cmake-modules,
|
||||
gamemode,
|
||||
ghc_filesystem,
|
||||
jdk17,
|
||||
kdePackages,
|
||||
libnbtplusplus,
|
||||
ninja,
|
||||
nix-filter,
|
||||
self,
|
||||
@ -16,16 +17,14 @@
|
||||
tomlplusplus,
|
||||
zlib,
|
||||
msaClientID ? null,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
version,
|
||||
libnbtplusplus,
|
||||
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
||||
}:
|
||||
assert lib.assertMsg (
|
||||
gamemodeSupport -> stdenv.isLinux
|
||||
gamemodeSupport -> stdenv.hostPlatform.isLinux
|
||||
) "gamemodeSupport is only available on Linux.";
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation {
|
||||
pname = "fjordlauncher-unwrapped";
|
||||
inherit version;
|
||||
version = self.shortRev or self.dirtyShortRev or "unknown";
|
||||
|
||||
src = nix-filter.lib {
|
||||
root = self;
|
||||
@ -64,20 +63,23 @@ stdenv.mkDerivation {
|
||||
tomlplusplus
|
||||
zlib
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [apple-sdk_11]
|
||||
++ lib.optional gamemodeSupport gamemode;
|
||||
|
||||
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
|
||||
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux ["pie"];
|
||||
|
||||
cmakeFlags =
|
||||
[ (lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") ]
|
||||
[
|
||||
# downstream branding
|
||||
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
|
||||
]
|
||||
++ lib.optionals (msaClientID != null) [
|
||||
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
|
||||
]
|
||||
++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [
|
||||
(lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5")
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# we wrap our binary manually
|
||||
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
|
||||
# disable built-in updater
|
||||
@ -104,4 +106,4 @@ stdenv.mkDerivation {
|
||||
mainProgram = "fjordlauncher";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
139
nix/wrapper.nix
139
nix/wrapper.nix
@ -1,71 +1,59 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
fjordlauncher-unwrapped,
|
||||
addDriverRunpath,
|
||||
alsa-lib,
|
||||
flite,
|
||||
gamemode,
|
||||
glfw,
|
||||
glfw-wayland-minecraft,
|
||||
glxinfo,
|
||||
jdk8,
|
||||
glfw3-minecraft,
|
||||
jdk17,
|
||||
jdk21,
|
||||
jdk8,
|
||||
kdePackages,
|
||||
lib,
|
||||
libGL,
|
||||
libX11,
|
||||
libXcursor,
|
||||
libXext,
|
||||
libXrandr,
|
||||
libXxf86vm,
|
||||
libjack2,
|
||||
libpulseaudio,
|
||||
libusb1,
|
||||
makeWrapper,
|
||||
mesa-demos,
|
||||
openal,
|
||||
pciutils,
|
||||
pipewire,
|
||||
fjordlauncher-unwrapped,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
udev,
|
||||
vulkan-loader,
|
||||
xorg,
|
||||
additionalLibs ? [ ],
|
||||
additionalPrograms ? [ ],
|
||||
controllerSupport ? stdenv.isLinux,
|
||||
gamemodeSupport ? stdenv.isLinux,
|
||||
xrandr,
|
||||
additionalLibs ? [],
|
||||
additionalPrograms ? [],
|
||||
controllerSupport ? stdenv.hostPlatform.isLinux,
|
||||
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
||||
jdks ? [
|
||||
jdk21
|
||||
jdk17
|
||||
jdk8
|
||||
],
|
||||
msaClientID ? null,
|
||||
textToSpeechSupport ? stdenv.isLinux,
|
||||
# Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH`
|
||||
# when launched on wayland, allowing for the game to be run natively.
|
||||
# Make sure to enable "Use system installation of GLFW" in instance settings
|
||||
# for this to take effect
|
||||
#
|
||||
# Warning: This build of glfw may be unstable, and the launcher
|
||||
# itself can take slightly longer to start
|
||||
withWaylandGLFW ? false,
|
||||
textToSpeechSupport ? stdenv.hostPlatform.isLinux,
|
||||
}:
|
||||
assert lib.assertMsg (
|
||||
controllerSupport -> stdenv.isLinux
|
||||
controllerSupport -> stdenv.hostPlatform.isLinux
|
||||
) "controllerSupport only has an effect on Linux.";
|
||||
assert lib.assertMsg (
|
||||
textToSpeechSupport -> stdenv.isLinux
|
||||
) "textToSpeechSupport only has an effect on Linux.";
|
||||
assert lib.assertMsg (
|
||||
withWaylandGLFW -> stdenv.isLinux
|
||||
) "withWaylandGLFW is only available on Linux.";
|
||||
let
|
||||
fjordlauncher' = fjordlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
|
||||
textToSpeechSupport -> stdenv.hostPlatform.isLinux
|
||||
) "textToSpeechSupport only has an effect on Linux."; let
|
||||
fjordlauncher' = fjordlauncher-unwrapped.override {inherit msaClientID gamemodeSupport;};
|
||||
in
|
||||
symlinkJoin {
|
||||
symlinkJoin {
|
||||
name = "fjordlauncher-${fjordlauncher'.version}";
|
||||
|
||||
paths = [ fjordlauncher' ];
|
||||
paths = [fjordlauncher'];
|
||||
|
||||
nativeBuildInputs =
|
||||
[
|
||||
kdePackages.wrapQtAppsHook
|
||||
]
|
||||
# purposefully using a shell wrapper here for variable expansion
|
||||
# see https://github.com/NixOS/nixpkgs/issues/172583
|
||||
++ lib.optional withWaylandGLFW makeWrapper;
|
||||
nativeBuildInputs = [kdePackages.wrapQtAppsHook];
|
||||
|
||||
buildInputs =
|
||||
[
|
||||
@ -73,67 +61,62 @@ symlinkJoin {
|
||||
kdePackages.qtsvg
|
||||
]
|
||||
++ lib.optional (
|
||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
|
||||
) kdePackages.qtwayland;
|
||||
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.hostPlatform.isLinux
|
||||
)
|
||||
kdePackages.qtwayland;
|
||||
|
||||
env = {
|
||||
waylandPreExec = lib.optionalString withWaylandGLFW ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
postBuild =
|
||||
lib.optionalString withWaylandGLFW ''
|
||||
qtWrapperArgs+=(--run "$waylandPreExec")
|
||||
''
|
||||
+ ''
|
||||
postBuild = ''
|
||||
wrapQtAppsHook
|
||||
'';
|
||||
|
||||
qtWrapperArgs =
|
||||
let
|
||||
qtWrapperArgs = let
|
||||
runtimeLibs =
|
||||
[
|
||||
# lwjgl
|
||||
glfw
|
||||
libpulseaudio
|
||||
libGL
|
||||
(lib.getLib stdenv.cc.cc)
|
||||
## native versions
|
||||
glfw3-minecraft
|
||||
openal
|
||||
stdenv.cc.cc.lib
|
||||
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
## openal
|
||||
alsa-lib
|
||||
libjack2
|
||||
libpulseaudio
|
||||
pipewire
|
||||
|
||||
## glfw
|
||||
libGL
|
||||
libX11
|
||||
libXcursor
|
||||
libXext
|
||||
libXrandr
|
||||
libXxf86vm
|
||||
|
||||
udev # oshi
|
||||
|
||||
xorg.libX11
|
||||
xorg.libXext
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXxf86vm
|
||||
vulkan-loader # VulkanMod's lwjgl
|
||||
]
|
||||
++ lib.optional textToSpeechSupport flite
|
||||
++ lib.optional gamemodeSupport gamemode.lib
|
||||
++ lib.optional controllerSupport libusb1
|
||||
++ additionalLibs;
|
||||
|
||||
runtimePrograms = [
|
||||
glxinfo
|
||||
pciutils # need lspci
|
||||
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
] ++ additionalPrograms;
|
||||
in
|
||||
runtimePrograms =
|
||||
[
|
||||
"--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"
|
||||
mesa-demos
|
||||
pciutils # need lspci
|
||||
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
++ additionalPrograms;
|
||||
in
|
||||
["--prefix FJORDLAUNCHER_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 (fjordlauncher'.meta)
|
||||
inherit
|
||||
(fjordlauncher'.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
@ -144,4 +127,4 @@ symlinkJoin {
|
||||
platforms
|
||||
;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user