32 stdenv.mkDerivation rec {
33 pname = "TrenchBroom";
36 src = fetchFromGitHub {
37 owner = "TrenchBroom";
40 hash = "sha256-HNK/gLbew7MKN6GVStxDb2tyMgyw2l1+dhPr6fSaZ4A=";
41 fetchSubmodules = true;
43 # Manually simulate a vcpkg installation so that it can link the libraries
47 vcpkg_target = "x64-linux";
60 updates_vcpkg_file = writeText "update_vcpkg_trenchbroom" (
61 lib.concatMapStringsSep "\n" (name: ''
63 Architecture : ${vcpkg_target}
70 export VCPKG_ROOT="$TMP/vcpkg"
72 mkdir -p $VCPKG_ROOT/.vcpkg-root
73 mkdir -p $VCPKG_ROOT/installed/${vcpkg_target}/lib
74 mkdir -p $VCPKG_ROOT/installed/vcpkg/updates
75 ln -s ${updates_vcpkg_file} $VCPKG_ROOT/installed/vcpkg/status
76 mkdir -p $VCPKG_ROOT/installed/vcpkg/info
77 ${lib.concatMapStrings (name: ''
78 touch $VCPKG_ROOT/installed/vcpkg/info/${name}_1.0_${vcpkg_target}.list
81 ln -s ${assimp.lib}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
82 ln -s ${catch2}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
83 ln -s ${fmt}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
84 ln -s ${freeimage}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
85 ln -s ${freetype}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
86 ln -s ${glew.out}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
87 ln -s ${miniz}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
88 ln -s ${tinyxml-2}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
91 substituteInPlace common/src/Version.h.in \
92 --subst-var-by APP_VERSION_YEAR ${lib.versions.major version} \
93 --subst-var-by APP_VERSION_NUMBER ${lib.versions.minor version} \
94 --subst-var-by GIT_DESCRIBE v${version}
95 substituteInPlace app/CMakeLists.txt \
96 --replace 'set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")' 'set(CPACK_PACKAGING_INSTALL_PREFIX "'$out'")'
127 QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}";
128 QT_QPA_PLATFORM = "offscreen";
131 "-DCMAKE_MAKE_PROGRAM=ninja"
132 "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
133 "-DVCPKG_MANIFEST_INSTALL=OFF"
134 # https://github.com/TrenchBroom/TrenchBroom/issues/4002#issuecomment-1125390780
135 "-DCMAKE_PREFIX_PATH=cmake/packages"
142 pushd $out/share/TrenchBroom/icons
144 for F in icon_*.png; do
145 SIZE=$(echo $F|sed -e s/icon_// -e s/.png//)
146 DIR=$out/share/icons/hicolor/$SIZE"x"$SIZE/apps
148 ln -s ../../../../TrenchBroom/icons/$F $DIR/trenchbroom.png
156 name = "TrenchBroom";
157 desktopName = "TrenchBroom level editor";
158 icon = "trenchbroom";
159 comment = meta.description;
160 categories = [ "Development" ];
161 exec = "trenchbroom";
166 homepage = "https://trenchbroom.github.io/";
167 changelog = "https://github.com/TrenchBroom/TrenchBroom/releases/tag/v${version}";
168 description = "Level editor for Quake-engine based games";
169 license = licenses.gpl3Only;
170 maintainers = with maintainers; [ astro ];
171 platforms = [ "x86_64-linux" ];