Closed dhruvio closed 6 years ago
translated from this guide: http://community.stencyl.com/index.php/topic,32022.0.html
You will also need to use callPackage_i686 instead of callPackage (since 32-bit only support). jdk8 is also in nixpkgs. Since it seems to be a proprietary package, you probably also need to set the library path manually like in this package: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/gorilla-bin/default.nix#L30
Cool, thanks @Mic92. I'm going to give writing the nix file a go.
Update:
I managed to get Stencyl running in my environment. I've included the default.nix
file below; here are the steps I took to get it working:
default.nix
inside a directory called src
. Note the URL responds with a tar.gz
download file. However, I had trouble getting fetchurl
to work with this URL because it doesn't end with a .tar.gz
-- is there any way to force recognition of the tar.gz
bundle, so it unpacks it appropriately?src/Stencyl
bash executable to simply use java
instead of the bundled run-time. This is because makeWrapper
is used in the installPhase
, making java
available in the executable's path. Is there is nicer way to do this directly in default.nix
?nix-env -f default.nix -i stencyl
. @Mic92, it installed fine without specifying a 32-bit install; I think Stencyl has added support for 64-bit dependencies since the docs were written on how to install it on Linux.Any other ways I can improve this?
{ pkgs ? import <nixpkgs> {} }:
let
version = "1.2.0";
in
pkgs.stdenv.mkDerivation {
name = "stencyl-${version}";
src = ./src;
buildInputs = with pkgs; [
makeWrapper
];
/*unpackCmd = ''*/
/*tar -xf $curSrc --one-top-level=stencyl*/
/*'';*/
installPhase = let
dependencies = with pkgs; [
boehmgc
xorg.libXext
xorg.libXtst
xorg.libXi
xorg.libXt
xorg.libXpm
xorg.libXp
xorg.libXmu
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXau
xorg.libXcursor
xorg.libXdmcp
xorg.libXfixes
xorg.libXinerama
xorg.libXrandr
xorg.libXrender
ncurses
gtk2-x11
atk
cairo
expat
fontconfig
fontconfig-ultimate
freetype
glib
gnome2.pango
libpng
zlib
nss
nspr
curl
alsaLib
jdk
];
libPath = pkgs.stdenv.lib.makeLibraryPath dependencies;
in ''
mkdir -p $out/bin $out/share/stencyl
mv * $out/share/stencyl
makeWrapper "$out/share/stencyl/Stencyl" "$out/bin/stencyl" \
--prefix LD_LIBRARY_PATH : "${libPath}" --prefix PATH : "${libPath}"
'';
}
Jdk probably does not belong to library path. If it is needed usually there is a shell script calling java
.
@Mic92 you're right, Stencyl comes with its own java executable. However, I ran into a problem using it -- I kept getting an error no such file or directory
with no other information. Changing to java
fixed that problem and started Stencyl. However, trying to build a game inside Stencyl fails due to a similar error when running the bundled haxe
and haxelib
executables: no such file or folder
with no further information. I'm not sure how to move forward -- callPackage_i686
doesn't affect the outcome either. Any thoughts?
So, I've made some progress. I'm now using patchelf
to reassign the interpreters for the bundled executables with one in the Nix store. Below is my updated default.nix
file.
I am getting an error now though, in which a bundled executable, $out/share/stencyl/plaf/haxe/haxelib
, fails to run due to a missing shared library, $out/share/stencyl/plaf/neko-linux/libneko.so
. The shared library is bundled with Stencyl; I'm not sure how to fix this error. Any ideas @Mic92 ?
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
version = "1.2.0";
in
stdenv.mkDerivation {
name = "stencyl-${version}";
src = fetchurl {
url = "http://www.stencyl.com/download/get/lin64/";
name = "Stencyl-64-full.tar.gz";
sha256 = "0adgsisk95hp0kiwzj49nb6w2d8g6hi0snkqbp1l7x5mhgf00zf2";
};
buildInputs = [
file
makeWrapper
];
unpackCmd = ''
tar -xf $curSrc --one-top-level=stencyl
'';
buildPhase = ''
find -executable -type f -exec file {} \; | \
grep 'ELF.*executable.*interpreter' | \
awk '{print $1}' | \
tr -d ':' | \
while read elf_executable; do
echo "Patching ELF interpreter for $elf_executable"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$elf_executable"
done
'';
installPhase = let
dependencies = [
boehmgc
xorg.libXext
xorg.libXtst
xorg.libXi
xorg.libXt
xorg.libXpm
xorg.libXp
xorg.libXmu
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libXau
xorg.libXcursor
xorg.libXdmcp
xorg.libXfixes
xorg.libXinerama
xorg.libXrandr
xorg.libXrender
ncurses
gtk2-x11
atk
cairo
expat
fontconfig
fontconfig-ultimate
freetype
glib
gnome2.pango
libpng
zlib
nss
nspr
curl
alsaLib
jdk
];
libPath = stdenv.lib.makeLibraryPath dependencies;
binPath = stdenv.lib.makeBinPath [ psmisc ];
in ''
mkdir -p $out/bin $out/share/stencyl
mv * $out/share/stencyl
makeWrapper "$out/share/stencyl/Stencyl" "$out/bin/stencyl" \
--prefix LD_LIBRARY_PATH : "${libPath}:$out/share/stencyl/plaf" \
--prefix PATH : "${binPath}"
'';
}
Can you add this as a pull request? Then it is easier to comment or edit. You either need to extend LD_LIBRARY_PATH
or expand rpath with patchelf to include share/stencyl/plaf/neko-linux
.
@Mic92 PR is up: https://github.com/NixOS/nixpkgs/pull/24881
Closing issue as I can't get the bundled Haxe dependency working correctly. Nixpkgs has a version of Haxe whose source is modified, and it is unclear how to integrate that with Stencyl. Hopefully someone with better knowledge of Haxe will be able to add this package to the repo.
I'm new to NixOS (running 17.03), and I'd like to install Stencyl. It is a game engine. There are installation instructions available for Debian-like systems here, but I'm not sure how to source the correct dependencies for NixOS. Would anyone be able to help me set up a
stencyl/default.nix
package? It would be great if we could merge this upstream too.