feat(nix): add darwin support

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-08-04 11:55:31 -04:00
parent 75c7df46a7
commit eeb5fdbc9f
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86
3 changed files with 51 additions and 44 deletions

View File

@ -25,8 +25,7 @@
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
# Disabled due to our packages not supporting darwin yet. "x86_64-darwin"
# "x86_64-darwin" "aarch64-darwin"
# "aarch64-darwin"
]; ];
} }

View File

@ -17,6 +17,7 @@
mkPrism = qt: mkPrism = qt:
qt.callPackage ./package.nix { qt.callPackage ./package.nix {
inherit (inputs) libnbtplusplus; inherit (inputs) libnbtplusplus;
inherit (prev.darwin.apple_sdk.frameworks) Cocoa;
inherit self version; inherit self version;
}; };
in { in {

View File

@ -2,6 +2,8 @@
lib, lib,
stdenv, stdenv,
cmake, cmake,
cmark,
Cocoa,
ninja, ninja,
jdk17, jdk17,
zlib, zlib,
@ -9,57 +11,62 @@
quazip, quazip,
extra-cmake-modules, extra-cmake-modules,
tomlplusplus, tomlplusplus,
cmark,
ghc_filesystem, ghc_filesystem,
gamemode, gamemode,
msaClientID ? null, msaClientID ? null,
gamemodeSupport ? true, gamemodeSupport ? stdenv.isLinux,
self, self,
version, version,
libnbtplusplus, libnbtplusplus,
}: }:
stdenv.mkDerivation rec { assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is only available on Linux";
pname = "prismlauncher-unwrapped"; stdenv.mkDerivation rec {
inherit version; pname = "prismlauncher-unwrapped";
inherit version;
src = lib.cleanSource self; src = lib.cleanSource self;
nativeBuildInputs = [extra-cmake-modules cmake jdk17 ninja]; nativeBuildInputs = [extra-cmake-modules cmake jdk17 ninja];
buildInputs = buildInputs =
[ [
qtbase qtbase
zlib zlib
quazip quazip
ghc_filesystem ghc_filesystem
tomlplusplus tomlplusplus
cmark cmark
] ]
++ lib.optional gamemodeSupport gamemode; ++ lib.optional gamemodeSupport gamemode
++ lib.optionals stdenv.isDarwin [Cocoa];
hardeningEnable = ["pie"]; hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
cmakeFlags = cmakeFlags =
lib.optionals (msaClientID != null) ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"] [
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"]; "-DLauncher_BUILD_PLATFORM=nixpkgs"
]
++ lib.optionals (msaClientID != null) ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"]
++ lib.optionals (lib.versionOlder qtbase.version "6") ["-DLauncher_QT_VERSION_MAJOR=5"]
++ lib.optionals stdenv.isDarwin ["-DINSTALL_BUNDLE=nodeps" "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''"];
postUnpack = '' postUnpack = ''
rm -rf source/libraries/libnbtplusplus rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
dontWrapQtApps = true;
meta = with lib; {
homepage = "https://prismlauncher.org/";
description = "A free, open source launcher for Minecraft";
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.
''; '';
platforms = platforms.linux;
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}"; dontWrapQtApps = true;
license = licenses.gpl3Only;
maintainers = with maintainers; [minion3665 Scrumplex]; meta = with lib; {
}; homepage = "https://prismlauncher.org/";
} description = "A free, open source launcher for Minecraft";
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.
'';
platforms = with platforms; linux ++ darwin;
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [minion3665 Scrumplex getchoo];
};
}