mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-07 05:23:16 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
118 lines
2.9 KiB
Nix
118 lines
2.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
cmake,
|
|
cmark,
|
|
darwin,
|
|
extra-cmake-modules,
|
|
gamemode,
|
|
ghc_filesystem,
|
|
jdk17,
|
|
kdePackages,
|
|
ninja,
|
|
nix-update-script,
|
|
stripJavaArchivesHook,
|
|
tomlplusplus,
|
|
zlib,
|
|
|
|
msaClientID ? null,
|
|
gamemodeSupport ? stdenv.hostPlatform.isLinux,
|
|
}:
|
|
|
|
let
|
|
libnbtplusplus = fetchFromGitHub {
|
|
owner = "PrismLauncher";
|
|
repo = "libnbtplusplus";
|
|
rev = "a5e8fd52b8bf4ab5d5bcc042b2a247867589985f";
|
|
hash = "sha256-A5kTgICnx+Qdq3Fir/bKTfdTt/T1NQP2SC+nhN1ENug=";
|
|
};
|
|
in
|
|
|
|
assert lib.assertMsg (
|
|
gamemodeSupport -> stdenv.hostPlatform.isLinux
|
|
) "gamemodeSupport is only available on Linux.";
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "prismlauncher-unwrapped";
|
|
version = "8.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "PrismLauncher";
|
|
repo = "PrismLauncher";
|
|
rev = finalAttrs.version;
|
|
hash = "sha256-460hB91M2hZm+uU1tywJEj20oRd5cz/NDvya8/vJdSA=";
|
|
};
|
|
|
|
postUnpack = ''
|
|
rm -rf source/libraries/libnbtplusplus
|
|
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
ninja
|
|
extra-cmake-modules
|
|
jdk17
|
|
stripJavaArchivesHook
|
|
];
|
|
|
|
buildInputs =
|
|
[
|
|
cmark
|
|
ghc_filesystem
|
|
kdePackages.qtbase
|
|
kdePackages.quazip
|
|
tomlplusplus
|
|
zlib
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
|
|
++ lib.optional gamemodeSupport gamemode;
|
|
|
|
hardeningEnable = lib.optionals stdenv.hostPlatform.isLinux [ "pie" ];
|
|
|
|
cmakeFlags =
|
|
[
|
|
# downstream branding
|
|
(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.hostPlatform.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;
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = {
|
|
description = "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.
|
|
'';
|
|
homepage = "https://prismlauncher.org/";
|
|
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.src.rev}";
|
|
license = lib.licenses.gpl3Only;
|
|
maintainers = with lib.maintainers; [
|
|
minion3665
|
|
Scrumplex
|
|
getchoo
|
|
];
|
|
mainProgram = "prismlauncher";
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
|
};
|
|
})
|