Fix build?

This commit is contained in:
Evan Goode 2024-10-26 15:25:27 -04:00
parent 7f52d57454
commit c15afbda4a
16 changed files with 469 additions and 426 deletions

View File

@ -681,7 +681,7 @@ jobs:
- name: Setup Cachix
uses: cachix/cachix-action@v15
with:
name: fjordlauncher
name: unmojang
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Run flake checks

192
flake.nix
View File

@ -1,10 +1,10 @@
{
description = "A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once (Fork of MultiMC)";
description = "Prism Launcher fork with support for alternative auth servers";
nixConfig = {
extra-substituters = ["https://prismlauncher.cachix.org"];
extra-substituters = [ "https://unmojang.cachix.org" ];
extra-trusted-public-keys = [
"prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c="
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
];
};
@ -19,18 +19,18 @@
nix-filter.url = "github:numtide/nix-filter";
/*
Inputs below this are optional and can be removed
Inputs below this are optional and can be removed
```
{
inputs.fjordlauncher = {
url = "github:unmojang/FjordLauncher";
inputs = {
flake-compat.follows = "";
```
{
inputs.fjordlauncher = {
url = "github:unmojang/FjordLauncher";
inputs = {
flake-compat.follows = "";
};
};
};
}
```
}
```
*/
flake-compat = {
@ -39,93 +39,105 @@
};
};
outputs = {
self,
nixpkgs,
libnbtplusplus,
nix-filter,
...
}: let
inherit (nixpkgs) lib;
outputs =
{
self,
nixpkgs,
libnbtplusplus,
nix-filter,
...
}:
let
inherit (nixpkgs) lib;
# While we only officially support aarch and x86_64 on Linux and MacOS,
# we expose a reasonable amount of other systems for users who want to
# build for most exotic platforms
systems = lib.systems.flakeExposed;
# While we only officially support aarch and x86_64 on Linux and MacOS,
# we expose a reasonable amount of other systems for users who want to
# build for most exotic platforms
systems = lib.systems.flakeExposed;
forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
in {
checks = forAllSystems (
system: let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;};
in
forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
checks = forAllSystems (
system:
let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
in
lib.filterAttrs (_: lib.isDerivation) checks'
);
);
devShells = forAllSystems (
system: let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
inputsFrom = [self.packages.${system}.fjordlauncher-unwrapped];
buildInputs = with pkgs; [
ccache
ninja
];
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.fjordlauncher-unwrapped ];
buildInputs = with pkgs; [
ccache
ninja
];
};
}
);
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
overlays.default =
final: prev:
let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
in
{
fjordlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
inherit
libnbtplusplus
nix-filter
self
version
;
};
fjordlauncher = final.callPackage ./nix/wrapper.nix { };
};
}
);
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
packages = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
overlays.default = final: prev: let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
in {
fjordlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
inherit
libnbtplusplus
nix-filter
self
version
;
};
# Build a scope from our overlay
fjordPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
fjordlauncher = final.callPackage ./nix/wrapper.nix {};
};
packages = forAllSystems (
system: let
pkgs = nixpkgsFor.${system};
# Build a scope from our overlay
fjordPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
# Grab our packages from it and set the default
packages = {
inherit (fjordPackages) fjordlauncher-unwrapped fjordlauncher;
default = fjordPackages.fjordlauncher;
};
in
# Grab our packages from it and set the default
packages = {
inherit (fjordPackages) fjordlauncher-unwrapped fjordlauncher;
default = fjordPackages.fjordlauncher;
};
in
# Only output them if they're available on the current system
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
);
);
# We put these under legacyPackages as they are meant for CI, not end user consumption
legacyPackages = forAllSystems (
system: let
fjordPackages = self.packages.${system};
legacyPackages = self.legacyPackages.${system};
in {
fjordlauncher-debug = fjordPackages.fjordlauncher.override {
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
};
# We put these under legacyPackages as they are meant for CI, not end user consumption
legacyPackages = forAllSystems (
system:
let
fjordPackages = self.packages.${system};
legacyPackages = self.legacyPackages.${system};
in
{
fjordlauncher-debug = fjordPackages.fjordlauncher.override {
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
};
fjordlauncher-unwrapped-debug = fjordPackages.fjordlauncher-unwrapped.overrideAttrs {
cmakeBuildType = "Debug";
dontStrip = true;
};
}
);
};
fjordlauncher-unwrapped-debug = fjordPackages.fjordlauncher-unwrapped.overrideAttrs {
cmakeBuildType = "Debug";
dontStrip = true;
};
}
);
};
}

View File

@ -500,9 +500,6 @@ QStringList getMinecraftJavaBundle()
auto appDataPath = QProcessEnvironment::systemEnvironment().value("APPDATA", "");
processpaths << FS::PathCombine(QFileInfo(appDataPath).absoluteFilePath(), ".minecraft", "runtime");
auto appDataPath = QProcessEnvironment::systemEnvironment().value("APPDATA", "");
processpaths << FS::PathCombine(QFileInfo(appDataPath).absoluteFilePath(), ".minecraft", "runtime");
// add the microsoft store version of the launcher to the search. the current path is:
// C:\Users\USERNAME\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime
auto localAppDataPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", "");

View File

@ -6,6 +6,7 @@
#include <QObject>
#include <QSet>
#include <QVector>
#include <optional>
#include "minecraft/auth/AccountData.h"
#include "minecraft/auth/AuthStep.h"

View File

@ -42,6 +42,7 @@
#include <QPair>
#include <QPixmap>
#include <QString>
#include <optional>
#include "AccountData.h"
#include "AuthSession.h"

View File

@ -109,11 +109,19 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile
const auto& scope = "service::user.auth.xboxlive.com::MBI_SSL";
oauth2.setScope(scope);
// QOAuth2AuthorizationCodeFlow doesn't pass a "scope" when refreshing access tokens, but Microsoft expects it.
oauth2.setModifyParametersFunction([](QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* parameters) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
oauth2.setModifyParametersFunction([&](QAbstractOAuth::Stage stage, QVariantMap* parameters) {
if (stage == QAbstractOAuth::Stage::RefreshingAccessToken) {
(*parameters)["scope"] = scope;
}
});
#else
oauth2.setModifyParametersFunction([&](QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* parameters) {
if (stage == QAbstractOAuth::Stage::RefreshingAccessToken) {
(*parameters).insert("scope", scope);
}
});
#endif
oauth2.setClientIdentifier(m_clientId);
oauth2.setNetworkAccessManager(APPLICATION->network().get());

View File

@ -1,5 +1,6 @@
#pragma once
#include <QObject>
#include <optional>
#include "minecraft/auth/AuthStep.h"
#include "net/NetJob.h"

View File

@ -17,10 +17,10 @@ Example (NixOS):
```nix
{
nix.settings = {
trusted-substituters = [ "https://prismlauncher.cachix.org" ];
trusted-substituters = [ "https://unmojang.cachix.org" ];
trusted-public-keys = [
"prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c="
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
];
};
}
@ -143,10 +143,10 @@ Example (NixOS):
```nix
{
nix.settings = {
trusted-substituters = [ "https://prismlauncher.cachix.org" ];
trusted-substituters = [ "https://unmojang.cachix.org" ];
trusted-public-keys = [
"prismlauncher.cachix.org-1:9/n/FGyABA2jLUVfY+DEp4hKds/rwO+SCOtbOkDzd+c="
"unmojang.cachix.org-1:OfHnbBNduZ6Smx9oNbLFbYyvOWSoxb2uPcnXPj4EDQY="
];
};
}

View File

@ -1,36 +1,47 @@
{
perSystem = {
config,
lib,
pkgs,
...
}: {
pre-commit.settings = {
hooks = {
markdownlint.enable = true;
perSystem =
{
config,
lib,
pkgs,
...
}:
{
pre-commit.settings = {
hooks = {
markdownlint.enable = true;
alejandra.enable = true;
deadnix.enable = true;
nil.enable = true;
alejandra.enable = true;
deadnix.enable = true;
nil.enable = true;
clang-format = {
enable = true;
types_or = ["c" "c++" "java" "json" "objective-c"];
clang-format = {
enable = true;
types_or = [
"c"
"c++"
"java"
"json"
"objective-c"
];
};
};
tools.clang-tools = lib.mkForce pkgs.clang-tools_18;
};
tools.clang-tools = lib.mkForce pkgs.clang-tools_18;
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
'';
inputsFrom = [ config.packages.fjordlauncher-unwrapped ];
buildInputs = with pkgs; [
ccache
ninja
];
};
formatter = pkgs.alejandra;
};
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
'';
inputsFrom = [config.packages.fjordlauncher-unwrapped];
buildInputs = with pkgs; [ccache ninja];
};
formatter = pkgs.alejandra;
};
}

View File

@ -2,36 +2,40 @@
inputs,
self,
...
}: {
perSystem = {
lib,
pkgs,
...
}: {
packages = let
ourPackages = lib.fix (final: self.overlays.default final pkgs);
in {
inherit
(ourPackages)
fjordlauncher-unwrapped
fjordlauncher
;
default = ourPackages.fjordlauncher;
}:
{
perSystem =
{
lib,
pkgs,
...
}:
{
packages =
let
ourPackages = lib.fix (final: self.overlays.default final pkgs);
in
{
inherit (ourPackages) fjordlauncher-unwrapped fjordlauncher;
default = ourPackages.fjordlauncher;
};
};
};
flake = {
overlays.default = final: prev: let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
in {
fjordlauncher-unwrapped = prev.callPackage ./pkg {
inherit (inputs) libnbtplusplus;
inherit version;
};
overlays.default =
final: prev:
let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
in
{
fjordlauncher-unwrapped = prev.callPackage ./pkg {
inherit (inputs) libnbtplusplus;
inherit version;
};
fjordlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {
inherit (final) fjordlauncher-unwrapped;
fjordlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {
inherit (final) fjordlauncher-unwrapped;
};
};
};
};
}

View File

@ -21,13 +21,14 @@
assert lib.assertMsg (
gamemodeSupport -> stdenv.isLinux
) "gamemodeSupport is only available on Linux.";
stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped";
inherit version;
stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped";
inherit version;
src = lib.fileset.toSource {
root = ../../.;
fileset = lib.fileset.unions (map (fileName: ../../${fileName}) [
src = lib.fileset.toSource {
root = ../../.;
fileset = lib.fileset.unions (
map (fileName: ../../${fileName}) [
"buildconfig"
"cmake"
"launcher"
@ -36,70 +37,71 @@ assert lib.assertMsg (
"tests"
"COPYING.md"
"CMakeLists.txt"
]);
};
]
);
};
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
jdk17
stripJavaArchivesHook
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
jdk17
stripJavaArchivesHook
];
buildInputs =
[
cmark
ghc_filesystem
kdePackages.qtbase
kdePackages.qtnetworkauth
kdePackages.quazip
tomlplusplus
zlib
]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
++ lib.optional gamemodeSupport gamemode;
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
cmakeFlags =
[
(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 [
# we wrap our binary manually
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
# disable built-in updater
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
];
buildInputs =
[
cmark
ghc_filesystem
kdePackages.qtbase
kdePackages.qtnetworkauth
kdePackages.quazip
tomlplusplus
zlib
]
++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Cocoa]
++ lib.optional gamemodeSupport gamemode;
dontWrapQtApps = true;
hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
cmakeFlags =
[
(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 [
# we wrap our binary manually
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
# disable built-in updater
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
];
dontWrapQtApps = true;
meta = {
description = "Prism Launcher fork with support for alternative auth servers";
longDescription = ''
Allows you to have multiple, separate instances of Minecraft (each with
their own mods, texture packs, saves, etc) and helps you manage them and
their associated options with a simple interface.
'';
homepage = "https://fjordlauncher.org/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
evan-goode
];
mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
meta = {
description = "Prism Launcher fork with support for alternative auth servers";
longDescription = ''
Allows you to have multiple, separate instances of Minecraft (each with
their own mods, texture packs, saves, etc) and helps you manage them and
their associated options with a simple interface.
'';
homepage = "https://fjordlauncher.org/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
evan-goode
];
mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}

View File

@ -22,8 +22,8 @@
udev,
vulkan-loader,
xorg,
additionalLibs ? [],
additionalPrograms ? [],
additionalLibs ? [ ],
additionalPrograms ? [ ],
controllerSupport ? stdenv.isLinux,
gamemodeSupport ? stdenv.isLinux,
jdks ? [
@ -50,47 +50,48 @@ assert lib.assertMsg (
) "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;};
) "withWaylandGLFW is only available on Linux.";
let
fjordlauncher' = fjordlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
in
symlinkJoin {
name = "fjordlauncher-${fjordlauncher'.version}";
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 ]
# purposefully using a shell wrapper here for variable expansion
# see https://github.com/NixOS/nixpkgs/issues/172583
++ lib.optional withWaylandGLFW makeWrapper;
buildInputs =
[
kdePackages.qtbase
kdePackages.qtsvg
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
)
kdePackages.qtwayland;
buildInputs =
[
kdePackages.qtbase
kdePackages.qtsvg
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.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
'';
};
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")
''
+ ''
wrapQtAppsHook
'';
postBuild =
lib.optionalString withWaylandGLFW ''
qtWrapperArgs+=(--run "$waylandPreExec")
''
+ ''
wrapQtAppsHook
'';
qtWrapperArgs = let
qtWrapperArgs =
let
runtimeLibs =
[
# lwjgl
@ -115,31 +116,28 @@ in
++ 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;
runtimePrograms = [
glxinfo
pciutils # need lspci
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
] ++ additionalPrograms;
in
["--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
++ lib.optionals stdenv.isLinux [
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
[ "--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
++ lib.optionals stdenv.isLinux [
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
meta = {
inherit
(fjordlauncher'.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
platforms
;
};
}
meta = {
inherit (fjordlauncher'.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
platforms
;
};
}

View File

@ -23,86 +23,85 @@
assert lib.assertMsg (
gamemodeSupport -> stdenv.isLinux
) "gamemodeSupport is only available on Linux.";
stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped";
inherit version;
stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped";
inherit version;
src = nix-filter.lib {
root = self;
include = [
"buildconfig"
"cmake"
"launcher"
"libraries"
"program_info"
"tests"
../COPYING.md
../CMakeLists.txt
];
};
src = nix-filter.lib {
root = self;
include = [
"buildconfig"
"cmake"
"launcher"
"libraries"
"program_info"
"tests"
../COPYING.md
../CMakeLists.txt
];
};
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
jdk17
stripJavaArchivesHook
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
jdk17
stripJavaArchivesHook
];
buildInputs =
[
cmark
ghc_filesystem
kdePackages.qtbase
kdePackages.qtnetworkauth
kdePackages.quazip
tomlplusplus
zlib
]
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
++ lib.optional gamemodeSupport gamemode;
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];
cmakeFlags =
[ (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 [
# we wrap our binary manually
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
# disable built-in updater
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
];
buildInputs =
[
cmark
ghc_filesystem
kdePackages.qtbase
kdePackages.qtnetworkauth
kdePackages.quazip
tomlplusplus
zlib
]
++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Cocoa]
++ lib.optional gamemodeSupport gamemode;
doCheck = true;
hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
dontWrapQtApps = true;
cmakeFlags =
[(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 [
# we wrap our binary manually
(lib.cmakeFeature "INSTALL_BUNDLE" "nodeps")
# disable built-in updater
(lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''")
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/")
];
doCheck = true;
dontWrapQtApps = true;
meta = {
description = "Prism Launcher fork with support for alternative auth servers";
longDescription = ''
Allows you to have multiple, separate instances of Minecraft (each with
their own mods, texture packs, saves, etc) and helps you manage them and
their associated options with a simple interface.
'';
homepage = "https://github.com/unmojang/FjordLauncher";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
Scrumplex
getchoo
];
mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
meta = {
description = "Prism Launcher fork with support for alternative auth servers";
longDescription = ''
Allows you to have multiple, separate instances of Minecraft (each with
their own mods, texture packs, saves, etc) and helps you manage them and
their associated options with a simple interface.
'';
homepage = "https://github.com/unmojang/FjordLauncher";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
evan-goode
];
mainProgram = "fjordlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}

View File

@ -22,8 +22,8 @@
udev,
vulkan-loader,
xorg,
additionalLibs ? [],
additionalPrograms ? [],
additionalLibs ? [ ],
additionalPrograms ? [ ],
controllerSupport ? stdenv.isLinux,
gamemodeSupport ? stdenv.isLinux,
jdks ? [
@ -50,47 +50,50 @@ assert lib.assertMsg (
) "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;};
) "withWaylandGLFW is only available on Linux.";
let
fjordlauncher' = fjordlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; };
in
symlinkJoin {
name = "fjordlauncher-${fjordlauncher'.version}";
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
]
# purposefully using a shell wrapper here for variable expansion
# see https://github.com/NixOS/nixpkgs/issues/172583
++ lib.optional withWaylandGLFW makeWrapper;
buildInputs =
[
kdePackages.qtbase
kdePackages.qtsvg
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux
)
kdePackages.qtwayland;
buildInputs =
[
kdePackages.qtbase
kdePackages.qtsvg
]
++ lib.optional (
lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.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
'';
};
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")
''
+ ''
wrapQtAppsHook
'';
postBuild =
lib.optionalString withWaylandGLFW ''
qtWrapperArgs+=(--run "$waylandPreExec")
''
+ ''
wrapQtAppsHook
'';
qtWrapperArgs = let
qtWrapperArgs =
let
runtimeLibs =
[
# lwjgl
@ -115,31 +118,30 @@ in
++ 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;
runtimePrograms = [
glxinfo
pciutils # need lspci
xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
] ++ additionalPrograms;
in
["--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"]
++ lib.optionals stdenv.isLinux [
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
[
"--prefix FJORDLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"
]
++ lib.optionals stdenv.isLinux [
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
meta = {
inherit
(fjordlauncher'.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
platforms
;
};
}
meta = {
inherit (fjordlauncher'.meta)
description
longDescription
homepage
changelog
license
maintainers
mainProgram
platforms
;
};
}

View File

@ -1,4 +1,11 @@
{pkgs ? import <nixos-unstable> {}}:
{
pkgs ? import <nixos-unstable> { },
}:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [inkscape icoutils imagemagick nodePackages_latest.svgo];
nativeBuildInputs = with pkgs; [
inkscape
icoutils
imagemagick
nodePackages_latest.svgo
];
}

View File

@ -1,7 +1,7 @@
#include <QTest>
#include <QTimer>
#include <iostream>
#include <sstream>
#include "Manifest.h"
@ -93,7 +93,7 @@ A-Name-That-Is-Way-Too-Loooooooooooooooooooooooooooooooooooooooooooooooonooooooo
}
QVERIFY(caught);
}
void test_misingColon()
void test_missingColon()
{
std::istringstream iss{ "Manifest-Version 1.0" };
bool caught = false;
@ -104,7 +104,7 @@ A-Name-That-Is-Way-Too-Loooooooooooooooooooooooooooooooooooooooooooooooonooooooo
}
QVERIFY(caught);
}
void test_misingSpace()
void test_missingSpace()
{
std::istringstream iss{ "Manifest-Version:1.0" };
bool caught = false;