PrismLauncher/nix/unwrapped.nix
Sefa Eyeoglu 8ba5444c6b
fix(nix): switch to KF6 ECM
The override can be removed after
https://github.com/NixOS/nixpkgs/pull/518987 reaches nixos-unstable

See https://github.com/NixOS/nixpkgs/pull/513691

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2026-05-14 12:27:25 +02:00

126 lines
2.7 KiB
Nix

{
lib,
stdenv,
cmake,
cmark,
gamemode,
jdk17,
kdePackages,
libnbtplusplus,
ninja,
pkg-config,
qrencode,
self,
stripJavaArchivesHook,
tomlplusplus,
zlib,
msaClientID ? null,
libarchive,
}:
let
date =
let
# YYYYMMDD
date' = lib.substring 0 8 self.lastModifiedDate;
year = lib.substring 0 4 date';
month = lib.substring 4 2 date';
date = lib.substring 6 2 date';
in
if (self ? "lastModifiedDate") then
lib.concatStringsSep "-" [
year
month
date
]
else
"unknown";
# Remove once https://github.com/NixOS/nixpkgs/pull/518987 lands
extra-cmake-modules = kdePackages.extra-cmake-modules.overrideAttrs (prevAttrs: {
meta = prevAttrs.meta // {
platforms = lib.platforms.all;
};
});
in
stdenv.mkDerivation {
pname = "prismlauncher-unwrapped";
version = "10.0-unstable-${date}";
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.unions [
../CMakeLists.txt
../COPYING.md
../buildconfig
../cmake
../launcher
../libraries
../program_info
../tests
];
};
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
nativeBuildInputs = [
cmake
ninja
extra-cmake-modules
pkg-config
jdk17
stripJavaArchivesHook
];
buildInputs = [
cmark
kdePackages.qtbase
kdePackages.qtnetworkauth
qrencode
libarchive
tomlplusplus
zlib
]
++ lib.optional stdenv.hostPlatform.isLinux gamemode;
cmakeFlags = [
# downstream branding
(lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs")
]
++ lib.optionals (msaClientID != null) [
(lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID))
]
++ 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/")
];
doCheck = true;
dontWrapQtApps = true;
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/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
Scrumplex
getchoo
];
mainProgram = "prismlauncher";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}