6 , withJpegSupport ? true # support jpeg output
7 , withPngSupport ? true # support png output
10 stdenv.mkDerivation rec {
14 url = "http://jedi.ks.uiuc.edu/~johns/tachyon/files/${version}/${pname}-${version}.tar.gz";
15 sha256 = "sha256-CSA8ECMRFJ9d9cw2dAn5bHJXQmZtGcJNtbqZTVqBpvU=";
17 buildInputs = lib.optionals stdenv.isDarwin [
19 ] ++ lib.optionals withJpegSupport [
21 ] ++ lib.optionals withPngSupport [
26 '' + lib.optionalString withJpegSupport ''
27 export USEJPEG=" -DUSEJPEG"
28 export JPEGLIB=" -ljpeg"
29 '' + lib.optionalString withPngSupport ''
30 export USEPNG=" -DUSEPNG"
31 export PNGLIB=" -lpng -lz"
33 arch = if stdenv.hostPlatform.system == "x86_64-linux" then "linux-64-thr" else
34 if stdenv.hostPlatform.system == "i686-linux" then "linux-thr" else
35 # 2021-03-29: multithread (-DTHR -D_REENTRANT) was disabled on linux-arm
36 # because it caused Sage's 3D plotting tests to hang indefinitely.
37 # see https://github.com/NixOS/nixpkgs/pull/117465
38 if stdenv.hostPlatform.system == "aarch64-linux" then "linux-arm" else
39 if stdenv.hostPlatform.system == "armv7l-linux" then "linux-arm" else
40 if stdenv.hostPlatform.system == "x86_64-darwin" then "macosx-thr" else
41 if stdenv.hostPlatform.system == "i686-darwin" then "macosx-64-thr" else
42 if stdenv.hostPlatform.system == "i686-cygwin" then "win32" else
43 if stdenv.hostPlatform.system == "x86_64-freebsd" then "bsd" else
44 if stdenv.hostPlatform.system == "x686-freebsd" then "bsd" else
45 throw "Don't know what arch to select for tachyon build";
49 # Remove absolute paths in Make-config (and unset variables so they can be set in preBuild)
50 ./no-absolute-paths.patch
51 # Include new targets (like arm)
55 # Ensure looks for nix-provided Carbon, not system frameworks
56 substituteInPlace unix/Make-arch \
57 --replace '-F/System/Library/Frameworks' ""
62 mkdir -p "$out"/{bin,lib,include,share/doc/tachyon,share/tachyon}
64 cp libtachyon.* "$out/lib"
66 cp src/*.h "$out/include/"
67 cp Changes Copyright README "$out/share/doc/tachyon"
68 cp -r scenes "$out/share/tachyon/scenes"
71 description = "A Parallel / Multiprocessor Ray Tracing System";
72 license = lib.licenses.bsd3;
73 maintainers = [lib.maintainers.raskin];
74 platforms = with lib.platforms; linux ++ cygwin ++ darwin;
75 homepage = "http://jedi.ks.uiuc.edu/~johns/tachyon/";