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,15 +11,15 @@
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,
}: }:
assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is only available on Linux";
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "prismlauncher-unwrapped"; pname = "prismlauncher-unwrapped";
inherit version; inherit version;
@ -34,13 +36,18 @@ stdenv.mkDerivation rec {
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
@ -57,9 +64,9 @@ stdenv.mkDerivation rec {
their own mods, texture packs, saves, etc) and helps you manage them and their own mods, texture packs, saves, etc) and helps you manage them and
their associated options with a simple interface. their associated options with a simple interface.
''; '';
platforms = platforms.linux; platforms = with platforms; linux ++ darwin;
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}"; changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}";
license = licenses.gpl3Only; license = licenses.gpl3Only;
maintainers = with maintainers; [minion3665 Scrumplex]; maintainers = with maintainers; [minion3665 Scrumplex getchoo];
}; };
} }