From 0f9bf0515e65efdb60b01d86ee30e01a4d17219d Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:22:35 +0200 Subject: [PATCH 1/2] libloot: init at 0.24.5 --- pkgs/by-name/li/libloot/deps.patch | 46 ++++++ pkgs/by-name/li/libloot/package.nix | 211 ++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 pkgs/by-name/li/libloot/deps.patch create mode 100644 pkgs/by-name/li/libloot/package.nix diff --git a/pkgs/by-name/li/libloot/deps.patch b/pkgs/by-name/li/libloot/deps.patch new file mode 100644 index 000000000000..d8f9a976c619 --- /dev/null +++ b/pkgs/by-name/li/libloot/deps.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 24c7d85..3d070d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,6 +79,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") + find_package(TBB REQUIRED) + endif() + ++#[==[ + if(NOT DEFINED ESPLUGIN_URL) + set(ESPLUGIN_URL "https://github.com/Ortham/esplugin/archive/refs/tags/6.1.0.tar.gz") + set(ESPLUGIN_HASH "SHA256=52dec796d98426e1c75c5cf3c41351c0b3431a6301137e00fcf6023f4e47b502") +@@ -153,6 +154,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + else() + set(LCI_LIBRARIES ${LCI_LIBRARIES} dl) + endif() ++#]==] + + FetchContent_Declare( + fmt +@@ -307,10 +309,6 @@ set(LIBLOOT_ALL_SOURCES + + # Build API. + add_library(loot ${LIBLOOT_ALL_SOURCES}) +-add_dependencies(loot +- esplugin +- libloadorder +- loot-condition-interpreter) + target_link_libraries(loot PRIVATE + Boost::headers + ${ESPLUGIN_LIBRARIES} +diff --git a/cmake/tests.cmake b/cmake/tests.cmake +index ebccd82..2cef53c 100644 +--- a/cmake/tests.cmake ++++ b/cmake/tests.cmake +@@ -108,10 +108,6 @@ set(LIBLOOT_INTERFACE_TESTS_ALL_SOURCES + + # Build tests. + add_executable(libloot_internals_tests ${LIBLOOT_INTERNALS_TESTS_ALL_SOURCES}) +-add_dependencies(libloot_internals_tests +- esplugin +- libloadorder +- loot-condition-interpreter) + target_link_libraries(libloot_internals_tests PRIVATE + Boost::headers + ${ESPLUGIN_LIBRARIES} diff --git a/pkgs/by-name/li/libloot/package.nix b/pkgs/by-name/li/libloot/package.nix new file mode 100644 index 000000000000..a7ab3ed42e53 --- /dev/null +++ b/pkgs/by-name/li/libloot/package.nix @@ -0,0 +1,211 @@ +{ + lib, + stdenv, + fetchFromGitHub, + + rustPlatform, + rust-cbindgen, + + cmake, + pkg-config, + + withDocs ? true, + doxygen, + python3Packages, + + boost, + fmt_11, + gtest, + icu, + spdlog, + tbb_2021_11, + yaml-cpp, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "libloot"; + version = "0.24.5"; + # Note: don't forget to also update the package versions in the passthru section + + outputs = [ + "out" + "dev" + ] ++ lib.optionals withDocs [ "doc" ]; + + src = fetchFromGitHub { + owner = "loot"; + repo = "libloot"; + rev = "refs/tags/${finalAttrs.version}"; + hash = "sha256-SAnbp34DlGsq4nfaRHfCTGRSGQtv/rRgngvwma2tc7Q="; + }; + + patches = [ + # don't try to build the rust FFI dependencies with cargo, since we build them separately + ./deps.patch + ]; + + postPatch = '' + # there seem to have been some changes in header files generated by rust-cbindgen, so we use the new names + substituteInPlace src/api/plugin.{h,cpp} \ + --replace-fail 'Vec_PluginMetadata' 'Vec<::PluginMetadata>' + ''; + + strictDeps = true; + + nativeBuildInputs = + [ + cmake + pkg-config + ] + ++ lib.optionals withDocs [ + doxygen + python3Packages.sphinx + python3Packages.sphinx-rtd-theme + python3Packages.breathe + ]; + + buildInputs = [ + boost + fmt_11 + gtest + icu + (spdlog.override { fmt = fmt_11; }) + tbb_2021_11 + + finalAttrs.passthru.yaml-cpp # has merge-key support + finalAttrs.passthru.libloadorder + finalAttrs.passthru.esplugin + finalAttrs.passthru.loot-condition-interpreter + ]; + + cmakeFlags = [ + (lib.cmakeFeature "ESPLUGIN_LIBRARIES" "esplugin_ffi") + (lib.cmakeFeature "LIBLOADORDER_LIBRARIES" "loadorder_ffi") + (lib.cmakeFeature "LCI_LIBRARIES" "loot_condition_interpreter_ffi") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TESTING-PLUGINS" "../testing-plugins") + (lib.cmakeBool "LIBLOOT_BUILD_TESTS" finalAttrs.doCheck) + (lib.cmakeBool "LIBLOOT_INSTALL_DOCS" withDocs) + ]; + + postConfigure = lib.optionalString finalAttrs.doCheck '' + cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} ../testing-plugins + ''; + + postBuild = lib.optionalString withDocs '' + sphinx-build -b html ../docs docs/html + ''; + + env.GTEST_FILTER = + let + disabledTests = [ + # Some locale releated tests fail because they need the LOCALE_ARCHIVE env var to be set to "${glibcLocales}/lib/locale/locale-archive" + # Due to storage size concerns of `glibcLocales`, we skip this + "CompareFilenames.shouldBeCaseInsensitiveAndLocaleInvariant" + "NormalizeFilename.shouldCaseFoldStringsAndBeLocaleInvariant" + + # Some filesystem related test fail because they assume `std::filesystem::equivalent` works with non-existent paths + "Filesystem.equivalentShouldNotRequireThatBothPathsExist" + "Filesystem.equivalentShouldBeCaseSensitive" + ]; + in + "-${builtins.concatStringsSep ":" disabledTests}"; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + passthru = { + testing-plugins = fetchFromGitHub { + owner = "Ortham"; + repo = "testing-plugins"; + rev = "refs/tags/1.6.2"; + hash = "sha256-3Aa98EwqpuGA3YlsRF8luWzXVEFO/rs6JXisXdLyIK4="; + }; + + buildRustFFIPackage = + args: + rustPlatform.buildRustPackage ( + args + // { + postConfigure = '' + cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} testing-plugins + ''; + + nativeBuildInputs = [ rust-cbindgen ]; + + buildAndTestSubdir = "ffi"; + + postBuild = '' + cbindgen ffi/ -l "$lang" -o "$out/include/$header" + ''; + } + ); + + libloadorder = finalAttrs.passthru.buildRustFFIPackage rec { + pname = "libloadorder"; + version = "18.1.3"; + + src = fetchFromGitHub { + owner = "Ortham"; + repo = "libloadorder"; + rev = "refs/tags/${version}"; + hash = "sha256-qJ7gC4BkrXJiVcyA1BqlJSRzgc/7VmNBHtDq0ouJoTU="; + }; + + cargoHash = "sha256-x4LFO6dD3bBKv6gTrNUAo7Rdw5cP67gn44QP6Iwbv0I="; + + lang = "c++"; + header = "libloadorder.hpp"; + }; + + esplugin = finalAttrs.passthru.buildRustFFIPackage rec { + pname = "esplugin"; + version = "6.1.1"; + + src = fetchFromGitHub { + owner = "Ortham"; + repo = "esplugin"; + rev = "refs/tags/${version}"; + hash = "sha256-ygjSyixg+9HFFNV/G+w+TxGFTrjlWxlDt8phpCE8xyQ="; + }; + + cargoHash = "sha256-39iod83yVU5PyIjwv7pLLuMeNw9fHiM0tXDauyGrbx8="; + + lang = "c++"; + header = "esplugin.hpp"; + }; + + loot-condition-interpreter = finalAttrs.passthru.buildRustFFIPackage rec { + pname = "loot-condition-interpreter"; + version = "4.0.2"; + + src = fetchFromGitHub { + owner = "loot"; + repo = "loot-condition-interpreter"; + rev = "refs/tags/${version}"; + hash = "sha256-yXbe7ByYHvFpokRpV2pz2SX0986dpk5IpehwDUhoZKg="; + }; + + cargoHash = "sha256-p+raWZkW16MrvfZhJigSPth8pZZ68twU1+0GL/Mo1Xw="; + + lang = "c"; + header = "loot_condition_interpreter.h"; + }; + + yaml-cpp = yaml-cpp.overrideAttrs rec { + version = "0.8.0+merge-key-support.2"; + src = fetchFromGitHub { + owner = "loot"; + repo = "yaml-cpp"; + rev = "refs/tags/${version}"; + hash = "sha256-whYorebrLiDeO75LC2SMUX/8OD528BR0+DEgnJxxpoQ="; + }; + }; + }; + + meta = { + description = "C++ library for accessing LOOT's metadata and sorting functionality"; + homepage = "https://github.com/loot/libloot"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ tomasajt ]; + platforms = lib.platforms.linux; + }; +}) From b5711fd002a7dcb5b0c452602e4692d9028d9982 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:22:54 +0200 Subject: [PATCH 2/2] limo: init at 1.0.8.2 --- pkgs/by-name/li/limo/package.nix | 82 +++++++++++++++++++++++++ pkgs/by-name/li/limo/remove-unrar.patch | 42 +++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 pkgs/by-name/li/limo/package.nix create mode 100644 pkgs/by-name/li/limo/remove-unrar.patch diff --git a/pkgs/by-name/li/limo/package.nix b/pkgs/by-name/li/limo/package.nix new file mode 100644 index 000000000000..81fbb5743cba --- /dev/null +++ b/pkgs/by-name/li/limo/package.nix @@ -0,0 +1,82 @@ +{ + lib, + stdenv, + fetchFromGitHub, + + cmake, + pkg-config, + + jsoncpp, + libarchive, + libcpr, + libloot, + pugixml, + + libsForQt5, + + withUnrar ? true, + unrar, # has an unfree license +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "limo"; + version = "1.0.8.2"; + + src = fetchFromGitHub { + owner = "limo-app"; + repo = "limo"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-6rv1IjWb/nrymd57CtrlAjX2KfMYlYNnfiodiRAJ1Ok="; + }; + + patches = lib.optionals (!withUnrar) [ + # remove `unrar` as fallback when libarchive fails + ./remove-unrar.patch + ]; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + pkg-config + libsForQt5.wrapQtAppsHook + ]; + + buildInputs = + [ + jsoncpp + libarchive + libcpr + libloot + pugixml + + libsForQt5.qtbase + libsForQt5.qtsvg + libsForQt5.qtwayland + ] + ++ lib.optionals withUnrar [ + unrar + ]; + + cmakeFlags = + [ + (lib.cmakeFeature "LIMO_INSTALL_PREFIX" (placeholder "out")) + (lib.cmakeBool "USE_SYSTEM_LIBUNRAR" true) + ] + ++ lib.optionals (!withUnrar) [ + (lib.cmakeFeature "LIBUNRAR_PATH" "") + (lib.cmakeFeature "LIBUNRAR_INCLUDE_DIR" "") + ]; + + meta = { + description = "General purpose mod manager with support for the NexusMods API and LOOT"; + homepage = "https://github.com/limo-app/limo"; + license = lib.licenses.gpl3Plus; + mainProgram = "Limo"; + maintainers = with lib.maintainers; [ + tomasajt + MattSturgeon + ]; + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/by-name/li/limo/remove-unrar.patch b/pkgs/by-name/li/limo/remove-unrar.patch new file mode 100644 index 000000000000..7e6373eecf28 --- /dev/null +++ b/pkgs/by-name/li/limo/remove-unrar.patch @@ -0,0 +1,42 @@ +diff --git a/src/core/installer.cpp b/src/core/installer.cpp +index ea384a8..aab8be0 100644 +--- a/src/core/installer.cpp ++++ b/src/core/installer.cpp +@@ -7,7 +7,6 @@ + #include + #include + #define _UNIX +-#include + + namespace sfs = std::filesystem; + namespace pu = path_utils; +@@ -35,6 +34,8 @@ void Installer::extract(const sfs::path& source_path, + } + catch(CompressionError& error) + { ++ throw error; ++ /* + std::string extension = source_path.extension().string(); + std::transform(extension.begin(), + extension.end(), +@@ -48,6 +49,7 @@ void Installer::extract(const sfs::path& source_path, + } + else + throw error; ++ */ + } + for(const auto& dir_entry : sfs::recursive_directory_iterator(dest_path)) + { +@@ -428,6 +430,7 @@ void Installer::extractWithProgress(const sfs::path& source_path, + sfs::current_path(working_dir); + } + ++/* + void Installer::extractRarArchive(const sfs::path& source_path, const sfs::path& dest_path) + { + log(Log::LOG_DEBUG, "Using fallback rar extraction"); +@@ -459,3 +462,4 @@ void Installer::extractRarArchive(const sfs::path& source_path, const sfs::path& + throw CompressionError("Failed to extract RAR archive."); + RARCloseArchive(hArcData); + } ++*/