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

Add antichamber, an humble (indie!) bundle game #14

Merged
merged 1 commit into from
Jul 28, 2017
Merged
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
56 changes: 56 additions & 0 deletions pkgs/games/humblebundle/antichamber.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ stdenv, lib, fetchHumbleBundle, unzip
, xorg, libpulseaudio, libvorbis, libogg, mesa }:

stdenv.mkDerivation rec {
name = "antichamber-1.1";

src = fetchHumbleBundle {
name = "antichamber_1.01_linux_1392664980.sh";
machineName = "antichamber_linux";
md5 = "37bca01c411d813c8729259b7db2dba0";
};

dontStrip = true;
phases = ["installPhase"];

installPhase = let
rpath = lib.makeLibraryPath [
"$dest/Binaries/Linux"
xorg.libX11
xorg.libXi
stdenv.cc.cc.lib
libpulseaudio
libvorbis
libogg
mesa
Copy link
Member

Choose a reason for hiding this comment

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

Please add these dependencies to the package function arguments explicitly.

];
in ''
dest="$out/share/antichamber"

# Unpack binaries and data into $dest
mkdir -p "$dest"
${unzip}/bin/unzip $src "data/*" -d $dest && [ $? -le 2 ]
Copy link
Member

Choose a reason for hiding this comment

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

What about unpackCmd = "${unzip}/bin/unzip -d \"$name\" \"$curSrc\" 'data/*'"; instead of throwing everything into installPhase?

Copy link
Member

Choose a reason for hiding this comment

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

Even better: just unzip the data folder, so no -d is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an habit I started with archlinux & AUR. I want to unzip in $dest because it is in the nix store partition, while $CWD will be on a temporary partition. For big binary/data archives, this is faster because it remains on the same partition, and mv operations are mostly immediate.

This could however go in the unpackPhase, but the generic build script requires the unpack phase to unpack into the temporary directory used for the build.
It is truly an install phase, unpack is only needed for sources before compilation. There is no such thing here.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, fair enough, for very large files this would take ages.

mv $dest/data/*/* $dest
Copy link
Member

Choose a reason for hiding this comment

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

I'd assume here that data/* is just a single directory, right? If yes, see the above comment about unzip, which in this case would make even more sense to pass that subdirectory to unzip.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's directories + files, but I only want the directories (no readme and installer stuffs)

rm -r $dest/data

# Patch heavily :-)
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${rpath}" "$dest/Binaries/Linux/UDKGame-Linux"
for exe in $dest/Binaries/Linux/lib/*.so{,.*} ; do
patchelf --set-rpath "${rpath}" "$exe"
done

# Fixup permissions, just to be sure.
find "$dest" -type f -exec chmod 644 "{}" +
find "$dest/Binaries" -type f -exec chmod 755 "{}" +

mkdir -p "$out/bin"
cat > $out/bin/antichamber <<EOF
#!${stdenv.shell}
cd $dest/Binaries/Linux/
exec ./UDKGame-Linux "$@"
EOF
chmod 755 $out/bin/antichamber
'';
}
1 change: 1 addition & 0 deletions pkgs/games/humblebundle/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let
inherit (config.humblebundle) email password;
};

antichamber = callPackage_i686 ./antichamber.nix { };
bastion = callPackage ./bastion.nix {};
brigador = callPackage ./brigador.nix {};
cavestoryplus = callPackage ./cavestoryplus.nix {};
Expand Down