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 - name: Setup Cachix
uses: cachix/cachix-action@v15 uses: cachix/cachix-action@v15
with: with:
name: fjordlauncher name: unmojang
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Run flake checks - 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 = { nixConfig = {
extra-substituters = ["https://prismlauncher.cachix.org"]; extra-substituters = [ "https://unmojang.cachix.org" ];
extra-trusted-public-keys = [ 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"; 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 = { inputs.fjordlauncher = {
url = "github:unmojang/FjordLauncher"; url = "github:unmojang/FjordLauncher";
inputs = { inputs = {
flake-compat.follows = ""; flake-compat.follows = "";
};
}; };
}; }
} ```
```
*/ */
flake-compat = { flake-compat = {
@ -39,93 +39,105 @@
}; };
}; };
outputs = { outputs =
self, {
nixpkgs, self,
libnbtplusplus, nixpkgs,
nix-filter, libnbtplusplus,
... nix-filter,
}: let ...
inherit (nixpkgs) lib; }:
let
inherit (nixpkgs) lib;
# While we only officially support aarch and x86_64 on Linux and MacOS, # 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 # we expose a reasonable amount of other systems for users who want to
# build for most exotic platforms # build for most exotic platforms
systems = lib.systems.flakeExposed; systems = lib.systems.flakeExposed;
forAllSystems = lib.genAttrs systems; forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
in { in
checks = forAllSystems ( {
system: let checks = forAllSystems (
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix {inherit self;}; system:
in let
checks' = nixpkgsFor.${system}.callPackage ./nix/checks.nix { inherit self; };
in
lib.filterAttrs (_: lib.isDerivation) checks' lib.filterAttrs (_: lib.isDerivation) checks'
); );
devShells = forAllSystems ( devShells = forAllSystems (
system: let system:
pkgs = nixpkgsFor.${system}; let
in { pkgs = nixpkgsFor.${system};
default = pkgs.mkShell { in
inputsFrom = [self.packages.${system}.fjordlauncher-unwrapped]; {
buildInputs = with pkgs; [ default = pkgs.mkShell {
ccache inputsFrom = [ self.packages.${system}.fjordlauncher-unwrapped ];
ninja 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 # Build a scope from our overlay
version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; fjordPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
in {
fjordlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
inherit
libnbtplusplus
nix-filter
self
version
;
};
fjordlauncher = final.callPackage ./nix/wrapper.nix {}; # Grab our packages from it and set the default
}; packages = {
inherit (fjordPackages) fjordlauncher-unwrapped fjordlauncher;
packages = forAllSystems ( default = fjordPackages.fjordlauncher;
system: let };
pkgs = nixpkgsFor.${system}; in
# 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
# Only output them if they're available on the current system # Only output them if they're available on the current system
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
); );
# We put these under legacyPackages as they are meant for CI, not end user consumption # We put these under legacyPackages as they are meant for CI, not end user consumption
legacyPackages = forAllSystems ( legacyPackages = forAllSystems (
system: let system:
fjordPackages = self.packages.${system}; let
legacyPackages = self.legacyPackages.${system}; fjordPackages = self.packages.${system};
in { legacyPackages = self.legacyPackages.${system};
fjordlauncher-debug = fjordPackages.fjordlauncher.override { in
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug; {
}; fjordlauncher-debug = fjordPackages.fjordlauncher.override {
fjordlauncher-unwrapped = legacyPackages.fjordlauncher-unwrapped-debug;
};
fjordlauncher-unwrapped-debug = fjordPackages.fjordlauncher-unwrapped.overrideAttrs { fjordlauncher-unwrapped-debug = fjordPackages.fjordlauncher-unwrapped.overrideAttrs {
cmakeBuildType = "Debug"; cmakeBuildType = "Debug";
dontStrip = true; dontStrip = true;
}; };
} }
); );
}; };
} }

View File

@ -500,9 +500,6 @@ QStringList getMinecraftJavaBundle()
auto appDataPath = QProcessEnvironment::systemEnvironment().value("APPDATA", ""); auto appDataPath = QProcessEnvironment::systemEnvironment().value("APPDATA", "");
processpaths << FS::PathCombine(QFileInfo(appDataPath).absoluteFilePath(), ".minecraft", "runtime"); 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: // 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 // C:\Users\USERNAME\AppData\Local\Packages\Microsoft.4297127D64EC6_8wekyb3d8bbwe\LocalCache\Local\runtime
auto localAppDataPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", ""); auto localAppDataPath = QProcessEnvironment::systemEnvironment().value("LOCALAPPDATA", "");

View File

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

View File

@ -42,6 +42,7 @@
#include <QPair> #include <QPair>
#include <QPixmap> #include <QPixmap>
#include <QString> #include <QString>
#include <optional>
#include "AccountData.h" #include "AccountData.h"
#include "AuthSession.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"; const auto& scope = "service::user.auth.xboxlive.com::MBI_SSL";
oauth2.setScope(scope); oauth2.setScope(scope);
// QOAuth2AuthorizationCodeFlow doesn't pass a "scope" when refreshing access tokens, but Microsoft expects it. // 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) { if (stage == QAbstractOAuth::Stage::RefreshingAccessToken) {
(*parameters).insert("scope", scope); (*parameters).insert("scope", scope);
} }
}); });
#endif
oauth2.setClientIdentifier(m_clientId); oauth2.setClientIdentifier(m_clientId);
oauth2.setNetworkAccessManager(APPLICATION->network().get()); oauth2.setNetworkAccessManager(APPLICATION->network().get());

View File

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

View File

@ -17,10 +17,10 @@ Example (NixOS):
```nix ```nix
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-substituters = [ "https://unmojang.cachix.org" ];
trusted-public-keys = [ 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
{ {
nix.settings = { nix.settings = {
trusted-substituters = [ "https://prismlauncher.cachix.org" ]; trusted-substituters = [ "https://unmojang.cachix.org" ];
trusted-public-keys = [ 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 = { perSystem =
config, {
lib, config,
pkgs, lib,
... pkgs,
}: { ...
pre-commit.settings = { }:
hooks = { {
markdownlint.enable = true; pre-commit.settings = {
hooks = {
markdownlint.enable = true;
alejandra.enable = true; alejandra.enable = true;
deadnix.enable = true; deadnix.enable = true;
nil.enable = true; nil.enable = true;
clang-format = { clang-format = {
enable = true; enable = true;
types_or = ["c" "c++" "java" "json" "objective-c"]; 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, inputs,
self, self,
... ...
}: { }:
perSystem = { {
lib, perSystem =
pkgs, {
... lib,
}: { pkgs,
packages = let ...
ourPackages = lib.fix (final: self.overlays.default final pkgs); }:
in { {
inherit packages =
(ourPackages) let
fjordlauncher-unwrapped ourPackages = lib.fix (final: self.overlays.default final pkgs);
fjordlauncher in
; {
default = ourPackages.fjordlauncher; inherit (ourPackages) fjordlauncher-unwrapped fjordlauncher;
default = ourPackages.fjordlauncher;
};
}; };
};
flake = { flake = {
overlays.default = final: prev: let overlays.default =
version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; final: prev:
in { let
fjordlauncher-unwrapped = prev.callPackage ./pkg { version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
inherit (inputs) libnbtplusplus; in
inherit version; {
}; fjordlauncher-unwrapped = prev.callPackage ./pkg {
inherit (inputs) libnbtplusplus;
inherit version;
};
fjordlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix { fjordlauncher = prev.qt6Packages.callPackage ./pkg/wrapper.nix {
inherit (final) fjordlauncher-unwrapped; inherit (final) fjordlauncher-unwrapped;
};
}; };
};
}; };
} }

View File

@ -21,13 +21,14 @@
assert lib.assertMsg ( assert lib.assertMsg (
gamemodeSupport -> stdenv.isLinux gamemodeSupport -> stdenv.isLinux
) "gamemodeSupport is only available on Linux."; ) "gamemodeSupport is only available on Linux.";
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "fjordlauncher-unwrapped"; pname = "fjordlauncher-unwrapped";
inherit version; inherit version;
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ../../.; root = ../../.;
fileset = lib.fileset.unions (map (fileName: ../../${fileName}) [ fileset = lib.fileset.unions (
map (fileName: ../../${fileName}) [
"buildconfig" "buildconfig"
"cmake" "cmake"
"launcher" "launcher"
@ -36,70 +37,71 @@ assert lib.assertMsg (
"tests" "tests"
"COPYING.md" "COPYING.md"
"CMakeLists.txt" "CMakeLists.txt"
]); ]
}; );
};
postUnpack = '' postUnpack = ''
rm -rf source/libraries/libnbtplusplus rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
ninja ninja
extra-cmake-modules extra-cmake-modules
jdk17 jdk17
stripJavaArchivesHook 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 = dontWrapQtApps = true;
[
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"]; meta = {
description = "Prism Launcher fork with support for alternative auth servers";
cmakeFlags = longDescription = ''
[ Allows you to have multiple, separate instances of Minecraft (each with
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") their own mods, texture packs, saves, etc) and helps you manage them and
] their associated options with a simple interface.
++ lib.optionals (msaClientID != null) [ '';
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID)) homepage = "https://fjordlauncher.org/";
] license = lib.licenses.gpl3Only;
++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [ maintainers = with lib.maintainers; [
(lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5") evan-goode
] ];
++ lib.optionals stdenv.isDarwin [ mainProgram = "fjordlauncher";
# we wrap our binary manually platforms = lib.platforms.linux ++ lib.platforms.darwin;
(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;
};
}

View File

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

View File

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

View File

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

View File

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