aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/distribution.nix10
-rw-r--r--nix/package.nix57
2 files changed, 17 insertions, 50 deletions
diff --git a/nix/distribution.nix b/nix/distribution.nix
index 0b223f17..7c5ef93a 100644
--- a/nix/distribution.nix
+++ b/nix/distribution.nix
@@ -6,13 +6,13 @@
}: {
perSystem = {pkgs, ...}: {
packages = {
- inherit (pkgs) prismlauncher prismlauncher-qt5;
+ inherit (pkgs) prismlauncher-qt5-unwrapped prismlauncher-qt5 prismlauncher-unwrapped prismlauncher;
default = pkgs.prismlauncher;
};
};
flake = {
- overlays.default = _: prev: let
+ overlays.default = final: prev: let
# Helper function to build prism against different versions of Qt.
mkPrism = qt:
qt.callPackage ./package.nix {
@@ -20,8 +20,10 @@
inherit self version;
};
in {
- prismlauncher = mkPrism prev.qt6Packages;
- prismlauncher-qt5 = mkPrism prev.libsForQt5;
+ prismlauncher-qt5-unwrapped = mkPrism final.libsForQt5;
+ prismlauncher-qt5 = prev.prismlauncher-qt5.override {inherit (final) prismlauncher-unwrapped;};
+ prismlauncher-unwrapped = mkPrism final.qt6Packages;
+ prismlauncher = prev.prismlauncher.override {inherit (final) prismlauncher-unwrapped;};
};
};
}
diff --git a/nix/package.nix b/nix/package.nix
index e0616b6e..edc266dc 100644
--- a/nix/package.nix
+++ b/nix/package.nix
@@ -3,86 +3,51 @@
stdenv,
cmake,
ninja,
- jdk8,
jdk17,
zlib,
- file,
- wrapQtAppsHook,
- xorg,
- libpulseaudio,
qtbase,
- qtsvg,
- qtwayland,
- libGL,
quazip,
- glfw,
- openal,
extra-cmake-modules,
tomlplusplus,
- ghc_filesystem,
cmark,
- msaClientID ? "",
- jdks ? [jdk17 jdk8],
- gamemodeSupport ? true,
+ ghc_filesystem,
gamemode,
- # flake
+ msaClientID ? null,
+ gamemodeSupport ? true,
self,
version,
libnbtplusplus,
}:
stdenv.mkDerivation rec {
- pname = "prismlauncher";
+ pname = "prismlauncher-unwrapped";
inherit version;
src = lib.cleanSource self;
- nativeBuildInputs = [extra-cmake-modules cmake file jdk17 ninja wrapQtAppsHook];
+ nativeBuildInputs = [extra-cmake-modules cmake jdk17 ninja];
buildInputs =
[
qtbase
- qtsvg
zlib
quazip
ghc_filesystem
tomlplusplus
cmark
]
- ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland
- ++ lib.optional gamemodeSupport gamemode.dev;
+ ++ lib.optional gamemodeSupport gamemode;
+
+ hardeningEnable = ["pie"];
cmakeFlags =
- lib.optionals (msaClientID != "") ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"]
+ lib.optionals (msaClientID != null) ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"]
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"];
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
- mkdir source/libraries/libnbtplusplus
- ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus
- chmod -R +r+w source/libraries/libnbtplusplus
- chown -R $USER: source/libraries/libnbtplusplus
+ ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
- qtWrapperArgs = let
- libpath = with xorg;
- lib.makeLibraryPath ([
- libX11
- libXext
- libXcursor
- libXrandr
- libXxf86vm
- libpulseaudio
- libGL
- glfw
- openal
- stdenv.cc.cc.lib
- ]
- ++ lib.optional gamemodeSupport gamemode.lib);
- in [
- "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath}"
- "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}"
- # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
- "--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}"
- ];
+ dontWrapQtApps = true;
meta = with lib; {
homepage = "https://prismlauncher.org/";