From 0597b8792865c0d02ef78ff557c3852baf176803 Mon Sep 17 00:00:00 2001 From: Ivy Fan-Chiang Date: Sat, 19 Oct 2024 15:10:36 -0400 Subject: [PATCH 1/2] maintainers: add ivyfanchiang Signed-off-by: Ivy Fan-Chiang (cherry picked from commit 3f514ca30871c30d059d611398a2a16de3776cef) --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 0465e60379e5b..c266f693ee65d 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -8643,6 +8643,12 @@ githubId = 1318743; name = "Ivar"; }; + ivyfanchiang = { + email = "dev@ivyfanchiang.ca"; + github = "hexadecimalDinosaur"; + githubId = 36890802; + name = "Ivy Fan-Chiang"; + }; iwanb = { email = "tracnar@gmail.com"; github = "iwanb"; From 9939af6ed5e3cb2d16232e33da7382e099c234b7 Mon Sep 17 00:00:00 2001 From: Ivy Fan-Chiang Date: Sat, 19 Oct 2024 15:09:26 -0400 Subject: [PATCH 2/2] detect-it-easy: init at 3.09 Signed-off-by: Ivy Fan-Chiang (cherry picked from commit d6cd2901a282140c77751b20d37cea1f036b0da7) --- ...-remove-hard-coded-paths-in-xoptions.patch | 44 ++++++++++++ pkgs/by-name/de/detect-it-easy/package.nix | 68 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 pkgs/by-name/de/detect-it-easy/0001-remove-hard-coded-paths-in-xoptions.patch create mode 100644 pkgs/by-name/de/detect-it-easy/package.nix diff --git a/pkgs/by-name/de/detect-it-easy/0001-remove-hard-coded-paths-in-xoptions.patch b/pkgs/by-name/de/detect-it-easy/0001-remove-hard-coded-paths-in-xoptions.patch new file mode 100644 index 0000000000000..4d4744d4d31b3 --- /dev/null +++ b/pkgs/by-name/de/detect-it-easy/0001-remove-hard-coded-paths-in-xoptions.patch @@ -0,0 +1,44 @@ +diff --git a/XOptions/xoptions.cpp b/XOptions/xoptions.cpp +index ca5723e..30574a5 100755 +--- a/XOptions/xoptions.cpp ++++ b/XOptions/xoptions.cpp +@@ -1531,14 +1531,7 @@ bool XOptions::checkNative(const QString &sIniFileName) + #if defined(Q_OS_MAC) + bResult = true; + #elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) +- QString sApplicationDirPath = qApp->applicationDirPath(); +- +- if ((sApplicationDirPath == "/bin") || (sApplicationDirPath == "/usr/bin") || (sApplicationDirPath == "/usr/local/bin") || +- (sApplicationDirPath.contains("/usr/local/bin$")) || isAppImage()) { +- bResult = true; +- } else { +- bResult = false; +- } ++ bResult = true; + #elif defined(Q_OS_WIN) + QString sApplicationDirPath = qApp->applicationDirPath(); + +@@ -1565,22 +1558,7 @@ QString XOptions::getApplicationDataPath() + #ifdef Q_OS_MAC + sResult = sApplicationDirPath + "/../Resources"; + #elif defined(Q_OS_LINUX) +- if (isNative()) { +- if (sApplicationDirPath.contains("/usr/local/bin$")) { +- QString sPrefix = sApplicationDirPath.section("/usr/local/bin", 0, 0); +- +- sResult += sPrefix + QString("/usr/local/lib/%1").arg(qApp->applicationName()); +- } else { +- if (sApplicationDirPath.contains("/tmp/.mount_")) // AppImage +- { +- sResult = sApplicationDirPath.section("/", 0, 2); +- } +- +- sResult += QString("/usr/lib/%1").arg(qApp->applicationName()); +- } +- } else { +- sResult = sApplicationDirPath; +- } ++ sResult = sApplicationDirPath + "/../lib/die"; + #elif defined(Q_OS_FREEBSD) + sResult = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).at(1) + QDir::separator() + qApp->applicationName(); + #else diff --git a/pkgs/by-name/de/detect-it-easy/package.nix b/pkgs/by-name/de/detect-it-easy/package.nix new file mode 100644 index 0000000000000..855095c3f4483 --- /dev/null +++ b/pkgs/by-name/de/detect-it-easy/package.nix @@ -0,0 +1,68 @@ +{ + lib, + stdenv, + fetchFromGitHub, + libsForQt5, + freetype, + graphite2, + icu, + krb5, + systemdLibs, + imagemagick, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "detect-it-easy"; + version = "3.09"; + + src = fetchFromGitHub { + owner = "horsicq"; + repo = "DIE-engine"; + rev = finalAttrs.version; + fetchSubmodules = true; + hash = "sha256-A9YZBlGf3j+uSefPiDhrS1Qtu6vaLm4Yodt7BioGD2Q="; + }; + + patches = [ ./0001-remove-hard-coded-paths-in-xoptions.patch ]; + + buildInputs = [ + libsForQt5.qtbase + libsForQt5.qtscript + libsForQt5.qtsvg + graphite2 + freetype + icu + krb5 + systemdLibs + ]; + nativeBuildInputs = [ + libsForQt5.wrapQtAppsHook + libsForQt5.qmake + imagemagick + ]; + + enableParallelBuilding = true; + + # work around wrongly created dirs in `install.sh` + # https://github.com/horsicq/DIE-engine/issues/110 + preInstall = '' + mkdir -p $out/bin + mkdir -p $out/share/applications + mkdir -p $out/share/icons + ''; + + # clean up wrongly created dirs in `install.sh` and broken .desktop file + postInstall = '' + rm -r $out/lib/{bin,share} + grep -v "Version=#VERSION#" $src/LINUX/die.desktop > $out/share/applications/die.desktop + ''; + + meta = { + description = "Program for determining types of files for Windows, Linux and MacOS."; + mainProgram = "die"; + homepage = "https://github.com/horsicq/Detect-It-Easy"; + maintainers = with lib.maintainers; [ ivyfanchiang ]; + platforms = [ "x86_64-linux" ]; + license = lib.licenses.mit; + }; +})