13 stdenv.mkDerivation rec {
17 src = fetchFromGitHub {
18 owner = "UnknownShadow200";
21 sha256 = "sha256-m7pg9OL2RuCVKgFD3hMtIeY0XdJ1YviXBFVJH8/T5gI=";
24 nativeBuildInputs = [ dos2unix makeWrapper ];
27 # The ClassiCube sources have DOS-style newlines
28 # which causes problems with diff/patch.
29 dos2unix 'src/Platform_Posix.c' 'src/Core.h'
33 # Fix hardcoded font paths
35 # ClassiCube doesn't compile with its X11 backend
36 # because of issues with libXi.
38 # For some reason, the Makefile doesn't link
39 # with libcurl and openal when ClassiCube requires them.
40 # Also links with SDL2 instead of libX11 and libXi.
44 font_path = "${liberation_ttf}/share/fonts/truetype";
46 enableParallelBuilding = true;
49 # ClassiCube hardcodes locations of fonts.
50 # This changes the hardcoded location
51 # to the path of liberation_ttf instead
52 substituteInPlace src/Platform_Posix.c \
53 --replace '%NIXPKGS_FONT_PATH%' "${font_path}"
54 # ClassiCube's Makefile hardcodes JOBS=1 for some reason,
55 # even though it works perfectly well multi-threaded.
56 substituteInPlace src/Makefile \
57 --replace 'JOBS=1' "JOBS=$NIX_BUILD_CORES"
60 buildInputs = [ SDL2 libGL curl openal liberation_ttf ];
68 cp 'src/ClassiCube' "$out/bin"
69 # ClassiCube puts downloaded resources
70 # next to the location of the executable by default.
71 # This doesn't work with Nix
72 # as the location of the executable is read-only.
73 # We wrap the program to make it put its resources
74 # in ~/.local/share instead.
75 wrapProgram "$out/bin/ClassiCube" \
76 --run 'mkdir -p "$HOME/.local/share/ClassiCube"' \
77 --run 'cd "$HOME/.local/share/ClassiCube"'
81 homepage = "https://www.classicube.net/";
82 description = "A lightweight, custom Minecraft Classic/ClassiCube client with optional additions written from scratch in C";
83 license = licenses.bsd3;
84 platforms = platforms.linux;
85 maintainers = with maintainers; [ _360ied ];