25 stdenv.mkDerivation (finalAttrs: {
28 # Note: don't forget to also update the package versions in the passthru section
33 ] ++ lib.optionals withDocs [ "doc" ];
35 src = fetchFromGitHub {
38 rev = "refs/tags/${finalAttrs.version}";
39 hash = "sha256-SAnbp34DlGsq4nfaRHfCTGRSGQtv/rRgngvwma2tc7Q=";
43 # don't try to build the rust FFI dependencies with cargo, since we build them separately
48 # there seem to have been some changes in header files generated by rust-cbindgen, so we use the new names
49 substituteInPlace src/api/plugin.{h,cpp} \
50 --replace-fail 'Vec_PluginMetadata' 'Vec<::PluginMetadata>'
60 ++ lib.optionals withDocs [
62 python3Packages.sphinx
63 python3Packages.sphinx-rtd-theme
64 python3Packages.breathe
72 (spdlog.override { fmt = fmt_11; })
75 finalAttrs.passthru.yaml-cpp # has merge-key support
76 finalAttrs.passthru.libloadorder
77 finalAttrs.passthru.esplugin
78 finalAttrs.passthru.loot-condition-interpreter
82 (lib.cmakeFeature "ESPLUGIN_LIBRARIES" "esplugin_ffi")
83 (lib.cmakeFeature "LIBLOADORDER_LIBRARIES" "loadorder_ffi")
84 (lib.cmakeFeature "LCI_LIBRARIES" "loot_condition_interpreter_ffi")
85 (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TESTING-PLUGINS" "../testing-plugins")
86 (lib.cmakeBool "LIBLOOT_BUILD_TESTS" finalAttrs.doCheck)
87 (lib.cmakeBool "LIBLOOT_INSTALL_DOCS" withDocs)
90 postConfigure = lib.optionalString finalAttrs.doCheck ''
91 cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} ../testing-plugins
94 postBuild = lib.optionalString withDocs ''
95 sphinx-build -b html ../docs docs/html
101 # Some locale releated tests fail because they need the LOCALE_ARCHIVE env var to be set to "${glibcLocales}/lib/locale/locale-archive"
102 # Due to storage size concerns of `glibcLocales`, we skip this
103 "CompareFilenames.shouldBeCaseInsensitiveAndLocaleInvariant"
104 "NormalizeFilename.shouldCaseFoldStringsAndBeLocaleInvariant"
106 # Some filesystem related test fail because they assume `std::filesystem::equivalent` works with non-existent paths
107 "Filesystem.equivalentShouldNotRequireThatBothPathsExist"
108 "Filesystem.equivalentShouldBeCaseSensitive"
111 "-${builtins.concatStringsSep ":" disabledTests}";
113 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
116 testing-plugins = fetchFromGitHub {
118 repo = "testing-plugins";
119 rev = "refs/tags/1.6.2";
120 hash = "sha256-3Aa98EwqpuGA3YlsRF8luWzXVEFO/rs6JXisXdLyIK4=";
123 buildRustFFIPackage =
125 rustPlatform.buildRustPackage (
129 cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} testing-plugins
132 nativeBuildInputs = [ rust-cbindgen ];
134 buildAndTestSubdir = "ffi";
137 cbindgen ffi/ -l "$lang" -o "$out/include/$header"
142 libloadorder = finalAttrs.passthru.buildRustFFIPackage rec {
143 pname = "libloadorder";
146 src = fetchFromGitHub {
148 repo = "libloadorder";
149 rev = "refs/tags/${version}";
150 hash = "sha256-qJ7gC4BkrXJiVcyA1BqlJSRzgc/7VmNBHtDq0ouJoTU=";
153 cargoHash = "sha256-x4LFO6dD3bBKv6gTrNUAo7Rdw5cP67gn44QP6Iwbv0I=";
156 header = "libloadorder.hpp";
159 esplugin = finalAttrs.passthru.buildRustFFIPackage rec {
163 src = fetchFromGitHub {
166 rev = "refs/tags/${version}";
167 hash = "sha256-ygjSyixg+9HFFNV/G+w+TxGFTrjlWxlDt8phpCE8xyQ=";
170 cargoHash = "sha256-39iod83yVU5PyIjwv7pLLuMeNw9fHiM0tXDauyGrbx8=";
173 header = "esplugin.hpp";
176 loot-condition-interpreter = finalAttrs.passthru.buildRustFFIPackage rec {
177 pname = "loot-condition-interpreter";
180 src = fetchFromGitHub {
182 repo = "loot-condition-interpreter";
183 rev = "refs/tags/${version}";
184 hash = "sha256-yXbe7ByYHvFpokRpV2pz2SX0986dpk5IpehwDUhoZKg=";
187 cargoHash = "sha256-p+raWZkW16MrvfZhJigSPth8pZZ68twU1+0GL/Mo1Xw=";
190 header = "loot_condition_interpreter.h";
193 yaml-cpp = yaml-cpp.overrideAttrs rec {
194 version = "0.8.0+merge-key-support.2";
195 src = fetchFromGitHub {
198 rev = "refs/tags/${version}";
199 hash = "sha256-whYorebrLiDeO75LC2SMUX/8OD528BR0+DEgnJxxpoQ=";
205 description = "C++ library for accessing LOOT's metadata and sorting functionality";
206 homepage = "https://github.com/loot/libloot";
207 license = lib.licenses.gpl3Only;
208 maintainers = with lib.maintainers; [ tomasajt ];
209 platforms = lib.platforms.linux;