-
-
Save jjwatt/c83c02e6903c8ffaf546fe5eb27e7d25 to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {} }: | |
pkgs.mkShell { | |
# inputsFrom = with pkgs; [ pkgconfig autoconf automake gnumake ]; | |
buildInputs = with pkgs; [ | |
gcc | |
pkgconfig | |
autoconf | |
automake | |
libtool | |
pcre | |
gnumake | |
SDL2 | |
SDL2_gfx | |
SDL_image | |
SDL2_ttf | |
SDL2_mixer | |
harfbuzz | |
curl | |
gtk3 | |
gtk3-x11 | |
cmake | |
cmakeCurses | |
elementary-cmake-modules | |
extra-cmake-modules | |
libglvnd | |
mesa_glu | |
mesa_glu | |
freeglut | |
alsaLib | |
]; | |
} |
I've made an overlay for this, just create ~/.config/nixpkgs/overlays/tic80.nix
and put this inside:
self: super:
let
tic80-pkg = with import <nixpkgs> {}; stdenv.mkDerivation rec {
name = "tic80";
src = fetchgit {
fetchSubmodules = true;
url = "https://github.com/nesbox/TIC-80";
rev = "0feb848378fc40d16aaa609ed7a2148d7a064ac4";
sha256 = "12fl9wfc1577rmzcll50r3hq582010bpwd3yi15ji2vadc2q1w9l";
};
buildInputs = with pkgs; [
gcc
pkgconfig
autoconf
automake
libtool
pcre
gnumake
SDL2
SDL2_gfx
SDL_image
SDL2_ttf
SDL2_mixer
harfbuzz
curl
gtk3
gtk3-x11
cmake
cmakeCurses
elementary-cmake-modules
extra-cmake-modules
libglvnd
mesa_glu
mesa_glu
freeglut
alsaLib
];
configurePhase = ''
echo [DIRECTORY] $(pwd)
sed -i 's/BUILD_PRO "Build PRO version" FALSE/BUILD_PRO "Build PRO version" TRUE/' CMakeLists.txt
cd build/
cmake ..
'';
buildPhase = ''
make -j4
'';
installPhase = ''
mkdir -p $out/bin
chmod a+x bin/tic80
cp -v bin/tic80 $out/bin
'';
tic80Item = makeDesktopItem {
name = "TIC-80";
exec = "tic80";
comment = "Tiny Computer";
categories = "Development;Game";
desktopName = "TIC-80";
};
};
in {
tic80 = tic80-pkg;
}
and then install tic80
.
This automatically builds the pro version
Awesome! Thanks for sharing!
Also this won't update, you need once in a while to update rev to the latest commit and sha256 to the one provided by nix-prefetch-git --fetch-submodules $url
(nix-prefetch-git
is not provided by default; install it with the package nix-prefetch-git
)
This doesn't seem to work for v1.0. While the build finishes when running it the UI window doesn't open and it instead shows up in the terminal but it is not responsive. Issue nesbox/TIC-80#1922
I'm trying to build a native TIC-80 package myself. @jjwatt I tried the original shell.nix
and it failed for me during the make -j4
step. I'm getting an 'Error 2' which I'm still trying to diagnose, very cryptic. I also tried nix-build
with @winny- 's default.nix
but that errored out as well. I'm an extreme Nix noob so any help with this is appreciated. I'm on 23.11
The precise error I got was
AR build/host/lib/libmruby_core.a
ar: creating /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/lib/libmruby_core.a
LD build/host/bin/mrbc
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/lib/libmruby_core.a(codegen.o): undefined reference to symbol '__ctype_tolower_loc@@GLIBC_2.3'
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6: error adding symbols: DSO missing from command line
rake aborted!
Command failed with status (1): [ld -o "/home/daniel/src/misc/TIC-80/vendo...]
/home/daniel/src/misc/TIC-80/vendor/mruby/lib/mruby/build/command.rb:37:in `_run'
/home/daniel/src/misc/TIC-80/vendor/mruby/lib/mruby/build/command.rb:217:in `run'
/home/daniel/src/misc/TIC-80/vendor/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake:11:in `block (2 levels) in <top (required)>'
Tasks: TOP => all => gensym => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/presym => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/mrblib/mrblib.pi => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/mrblib/mrblib.c => /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/bin/mrbc
(See full trace by running task with --trace)
make[2]: *** [CMakeFiles/mruby_vendor.dir/build.make:86: mruby_vendor-prefix/src/mruby_vendor-stamp/mruby_vendor-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:324: CMakeFiles/mruby_vendor.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
So I think it's linking to the wrong libc, going off the line /nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/lib/libmruby_core.a(codegen.o): undefined reference to symbol '__ctype_tolower_loc@@GLIBC_2.3'
.
Hi there, I just tested my linked TIC-80 derivation using nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
and it completed successfully. Let's see if we can figure it out! I'm using 23.11 as well. Are you trying to build a local copy? Might be best to take one of the working derivations, then change the src
to point to your path. This way it'll build the same way as if pulling from upstream.
P.S. Feel free to take my work and contribute it to nixpkgs.
Thanks for preparing the package, @winny-! I made a PR to nixpkgs here: NixOS/nixpkgs#291129
Eh. I've got to add some updates to this based on building on my desktop where I use wayland, alsa, pulseaudio, etc. It did fine with these settings on my laptop under X, though. Having some issues with the sound right now on the desktop, and I'm not sure the root cause yet, so I don't want to post a bad shell.nix until I figure it out. My setup on my desktop is weird to say the least: coreboot/libreboot, sometimes IOMMU, sometimes not, pulseaudio, alsa and jack for ieee 1394 audio gear and sound cards. So, it could be related to any of the above :)