Skip to content

Commit

Permalink
Update default.nix
Browse files Browse the repository at this point in the history
Signed-off-by: hand7s <117505144+s0me1newithhand7s@users.noreply.github.com>
  • Loading branch information
s0me1newithhand7s authored Jul 10, 2024
1 parent ddbe0f4 commit 6d9f425
Showing 1 changed file with 96 additions and 70 deletions.
166 changes: 96 additions & 70 deletions nix/pkg/default.nix
Original file line number Diff line number Diff line change
@@ -1,87 +1,113 @@
{
lib,
stdenv,
canonicalize-jars-hook,
fetchFromGitHub,
cmake,
cmark,
Cocoa,
ninja,
jdk17,
zlib,
qtbase,
qtnetworkauth,
quazip,
darwin,
extra-cmake-modules,
tomlplusplus,
ghc_filesystem,
gamemode,
ghc_filesystem,
jdk17,
kdePackages,
ninja,
nix-update-script,
stripJavaArchivesHook,
tomlplusplus,
zlib,

msaClientID ? null,
gamemodeSupport ? stdenv.isLinux,
version,
libnbtplusplus,
}:
assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is only available on Linux";
stdenv.mkDerivation rec {
pname = "prismlauncher-unwrapped";
inherit version;

src = lib.fileset.toSource {
root = ../../.;
fileset = lib.fileset.unions (map (fileName: ../../${fileName}) [
"buildconfig"
"cmake"
"launcher"
"libraries"
"program_info"
"tests"
"COPYING.md"
"CMakeLists.txt"
]);
};
let
libnbtplusplus = fetchFromGitHub {
owner = "FreesmTeam";
repo = "libnbtplusplus";
rev = "23b955121b8217c1c348a9ed2483167a6f3ff4ad";
hash = "sha256-yy0q+bky80LtK1GWzz7qpM+aAGrOqLuewbid8WT1ilk=";
};
in

nativeBuildInputs = [extra-cmake-modules cmake jdk17 ninja canonicalize-jars-hook];
buildInputs =
[
qtbase
qtnetworkauth
zlib
quazip
ghc_filesystem
tomlplusplus
cmark
]
++ lib.optional gamemodeSupport gamemode
++ lib.optionals stdenv.isDarwin [Cocoa];
assert lib.assertMsg (
gamemodeSupport -> stdenv.isLinux
) "gamemodeSupport is only available on Linux.";

hardeningEnable = lib.optionals stdenv.isLinux ["pie"];
stdenv.mkDerivation (finalAttrs: {
pname = "freesmlaucnher-unwrapped";
version = "8.4";

cmakeFlags =
[
"-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=''"];
src = fetchFromGitHub {
owner = "FreesmTeam";
repo = "FreesmLauncher";
rev = finalAttrs.version;
hash = "sha256-wNz9rjcEFhS4jQIk0wl8y7zf2RY1kazQ/2hfTpoLEqg=";
};

postUnpack = ''
rm -rf source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
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.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
++ lib.optional gamemodeSupport gamemode;

dontWrapQtApps = true;
hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ];

meta = with lib; {
mainProgram = "prismlauncher";
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];
};
}
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.isDarwin [
# they 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://github.com/FreesmTeam/FreesmLauncher";
changelog = "https://github.com/FreesmTeam/FreesmLauncher/releases/tag/${finalAttrs.src.rev}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ s0me1newithhand7s notwindstone ];
mainProgram = "freesmlauncher";
platforms = lib.platforms.unix;
};
})

0 comments on commit 6d9f425

Please sign in to comment.