Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minosoft: init at 7ba4569 #244566

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions pkgs/games/minosoft/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{ lib, stdenv
, makeWrapper
, fetchFromGitLab
, gradle
, perl
, jre
, libpulseaudio
, makeDesktopItem
, copyDesktopItems
}:

let
pname = "minosoft";
version = "7ba4569"; # there are no tags yet, so lets version this using tags for now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In such case, you must use

Suggested change
version = "7ba4569"; # there are no tags yet, so lets version this using tags for now
version = "unstable-YYYY-MM-DD";

where the YYYY-MM-DD is the date of the commit you are picking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do


src = fetchFromGitLab {
domain = "gitlab.bixilon.de";
owner = "bixilon";
repo = "minosoft";
rev = "7ba45697e3586e0b6de231ed5db6d3e34cb37d82";
hash = "sha256-sro49mh6c20HN1ZAHp5Ukzmn5IcniuLTa0w43S8ZVNw=";
leaveDotGit = true; # needed by gradle scripts
};

# build jar into fixed-output derivation (it is fetching JARs to include from the internet anyways, so it doesnt matter if its not that conform to our ideals)
deps = stdenv.mkDerivation {
pname = "minosoft-deps";
inherit version src;
nativeBuildInputs = [ gradle perl ];
buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d)
# https://github.com/gradle/gradle/issues/4426
${lib.optionalString stdenv.isDarwin "export TERM=dumb"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be set unconditionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will evaluate what makes more sense.

gradle --no-daemon --info fatJar
'';
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
installPhase = ''
#find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
# | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
# | sh
cp -r . $out
'';
outputHashMode = "recursive";
outputHash = "sha256-yVlgw8zs1OD63xtCwaJpuYHr+LdxwXC0rfjR0ds7p5g=";
};

desktopItem = makeDesktopItem {
name = "minosoft";
desktopName = "Minosoft";
comment = "An open source Minecraft re-implementation written from scratch";
icon = "minosoft";
exec = "minosoft";
terminal = false;
categories = [ "Game" "AdventureGame" ];
keywords = [ "sandbox" "open" "source" "minecraft" ];
};

in stdenv.mkDerivation rec {
inherit pname version src;

nativeBuildInputs = [ gradle perl makeWrapper copyDesktopItems ];

desktopItems = [ desktopItem ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write the desktopItem directly here.


buildPhase = ''
CutestNekoAqua marked this conversation as resolved.
Show resolved Hide resolved
runHook preBuild
ls
echo ${deps}

runHook postBuild
'';

installPhase = ''
runHook preInstall

install -Dm644 build/libs/minosoft-fat*.jar $out/share/minosoft.jar
mkdir $out/bin
makeWrapper ${jre}/bin/java $out/bin/minosoft \
--prefix LD_LIBRARY_PATH : ${libpulseaudio}/lib \
--add-flags "-jar $out/share/minosoft.jar"

install -Dm644 doc/img/Minosoft_logo.png \
$out/share/pixmaps/minosoft.png

runHook postInstall
'';

meta = {
homepage = "https://gitlab.bixilon.de/bixilon/minosoft";
description = "An open source Minecraft re-implementation written from scratch";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
license = licenses.gpl3Plus;
maintainers = with maintainers; [ aprl ];
platforms = platforms.all;
# https://github.com/NixOS/nixpkgs/pull/99885#issuecomment-740065005
#broken = stdenv.isDarwin;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,8 @@ with pkgs;

melonDS = libsForQt5.callPackage ../applications/emulators/melonDS { };

minosoft = callPackage ../games/minosoft { };

mgba = libsForQt5.callPackage ../applications/emulators/mgba { };

mupen64plus = callPackage ../applications/emulators/mupen64plus { };
Expand Down