16 stdenv.mkDerivation rec {
20 src = fetchFromGitHub {
21 owner = "UnknownShadow200";
24 sha256 = "sha256-ZITyfxkQB4Jpm2ZsQyM+ouPLqCVmGB7UZRXDSU/BX0k=";
27 nativeBuildInputs = [ dos2unix makeWrapper copyDesktopItems ];
33 genericName = "Sandbox Block Game";
36 comment = "Minecraft Classic inspired sandbox game";
37 categories = [ "Game" ];
42 # The ClassiCube sources have DOS-style newlines
43 # which causes problems with diff/patch.
44 dos2unix 'src/Platform_Posix.c' 'src/Core.h'
48 # Fix hardcoded font paths
50 # For some reason, the Makefile doesn't link
51 # with libcurl and openal when ClassiCube requires them.
55 font_path = "${liberation_ttf}/share/fonts/truetype";
57 enableParallelBuilding = true;
60 # ClassiCube hardcodes locations of fonts.
61 # This changes the hardcoded location
62 # to the path of liberation_ttf instead
63 substituteInPlace src/Platform_Posix.c \
64 --replace '%NIXPKGS_FONT_PATH%' "${font_path}"
65 # ClassiCube's Makefile hardcodes JOBS=1 for some reason,
66 # even though it works perfectly well multi-threaded.
67 substituteInPlace Makefile \
68 --replace 'JOBS=1' "JOBS=$NIX_BUILD_CORES"
71 buildInputs = [ libX11 libXi libGL curl openal liberation_ttf ];
77 cp 'ClassiCube' "$out/bin"
78 # ClassiCube puts downloaded resources
79 # next to the location of the executable by default.
80 # This doesn't work with Nix
81 # as the location of the executable is read-only.
82 # We wrap the program to make it put its resources
83 # in ~/.local/share instead.
84 wrapProgram "$out/bin/ClassiCube" \
85 --run 'mkdir -p "$HOME/.local/share/ClassiCube"' \
86 --run 'cd "$HOME/.local/share/ClassiCube"'
88 mkdir -p "$out/share/icons/hicolor/256x256/apps"
89 cp misc/CCicon.png "$out/share/icons/hicolor/256x256/apps"
95 homepage = "https://www.classicube.net/";
96 description = "Lightweight, custom Minecraft Classic/ClassiCube client with optional additions written from scratch in C";
97 license = licenses.bsd3;
98 platforms = platforms.linux;
99 maintainers = with maintainers; [ _360ied ];
100 mainProgram = "ClassiCube";