leocad: enable povray support

To make povray work, the configurability of its path needs to be
disabled, as otherwise the povray binary's absolute path would be stored
in the leocad profile, breaking it as soon as povray is updated with a
changed store path.

A patch disables the configurability and makes leocad call a hardcoded
path pointing to the povray binary provided through
propagatedBuildInputs

Co-authored-by: Nikolay Korotkiy <sikmir@disroot.org>
Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>

+83
+11
pkgs/applications/graphics/leocad/default.nix
··· 2 2 , mkDerivation 3 3 , fetchFromGitHub 4 4 , fetchurl 5 + , povray 5 6 , qmake 6 7 , qttools 8 + , substituteAll 7 9 , zlib 8 10 }: 9 11 ··· 33 35 nativeBuildInputs = [ qmake qttools ]; 34 36 35 37 buildInputs = [ zlib ]; 38 + 39 + propagatedBuildInputs = [ povray ]; 40 + 41 + patches = [ 42 + (substituteAll { 43 + src = ./povray.patch; 44 + inherit povray; 45 + }) 46 + ]; 36 47 37 48 qmakeFlags = [ 38 49 "INSTALL_PREFIX=${placeholder "out"}"
+72
pkgs/applications/graphics/leocad/povray.patch
··· 1 + From 6e7dd2c763e2cc79db4cd7173921a4e72ce9b95e Mon Sep 17 00:00:00 2001 2 + From: Elias Probst <mail@eliasprobst.eu> 3 + Date: Tue, 5 Oct 2021 02:55:18 +0200 4 + Subject: [PATCH] Don't use configurable POV-ray path. 5 + 6 + Once the POV-ray path is configurable, it'll be written to the LeoCAD 7 + profile, which will break upon the next update of POV-ray which will 8 + have a different Nix store path. 9 + 10 + Signed-off-by: Elias Probst <mail@eliasprobst.eu> 11 + --- 12 + common/lc_application.cpp | 1 - 13 + common/lc_profile.cpp | 2 +- 14 + qt/lc_qpreferencesdialog.cpp | 3 ++- 15 + qt/lc_renderdialog.cpp | 2 +- 16 + 4 files changed, 4 insertions(+), 4 deletions(-) 17 + 18 + diff --git a/common/lc_application.cpp b/common/lc_application.cpp 19 + index cbdec82e..21974510 100644 20 + --- a/common/lc_application.cpp 21 + +++ b/common/lc_application.cpp 22 + @@ -1267,7 +1267,6 @@ void lcApplication::ShowPreferencesDialog() 23 + lcSetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME, Options.DefaultAuthor); 24 + lcSetProfileString(LC_PROFILE_PARTS_LIBRARY, Options.LibraryPath); 25 + lcSetProfileString(LC_PROFILE_MINIFIG_SETTINGS, Options.MinifigSettingsPath); 26 + - lcSetProfileString(LC_PROFILE_POVRAY_PATH, Options.POVRayPath); 27 + lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath); 28 + lcSetProfileString(LC_PROFILE_LANGUAGE, Options.Language); 29 + lcSetProfileInt(LC_PROFILE_CHECK_UPDATES, Options.CheckForUpdates); 30 + diff --git a/common/lc_profile.cpp b/common/lc_profile.cpp 31 + index 1975b586..911c4fb0 100644 32 + --- a/common/lc_profile.cpp 33 + +++ b/common/lc_profile.cpp 34 + @@ -132,7 +132,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] = 35 + lcProfileEntry("HTML", "ImageWidth", 640), // LC_PROFILE_HTML_IMAGE_WIDTH 36 + lcProfileEntry("HTML", "ImageHeight", 480), // LC_PROFILE_HTML_IMAGE_HEIGHT 37 + 38 + - lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH 39 + + lcProfileEntry("POVRay", "Path", "@povray@/bin/povray"), // LC_PROFILE_POVRAY_PATH 40 + lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH 41 + lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH 42 + lcProfileEntry("POVRay", "Height", 720), // LC_PROFILE_POVRAY_HEIGHT 43 + diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp 44 + index 89f86aad..c239763f 100644 45 + --- a/qt/lc_qpreferencesdialog.cpp 46 + +++ b/qt/lc_qpreferencesdialog.cpp 47 + @@ -55,7 +55,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO 48 + ui->partsLibrary->setText(mOptions->LibraryPath); 49 + ui->ColorConfigEdit->setText(mOptions->ColorConfigPath); 50 + ui->MinifigSettingsEdit->setText(mOptions->MinifigSettingsPath); 51 + - ui->povrayExecutable->setText(mOptions->POVRayPath); 52 + + ui->povrayExecutable->hide(); 53 + + ui->povrayExecutableBrowse->hide(); 54 + ui->lgeoPath->setText(mOptions->LGEOPath); 55 + ui->authorName->setText(mOptions->DefaultAuthor); 56 + ui->mouseSensitivity->setValue(mOptions->Preferences.mMouseSensitivity); 57 + diff --git a/qt/lc_renderdialog.cpp b/qt/lc_renderdialog.cpp 58 + index bd8a9102..96794738 100644 59 + --- a/qt/lc_renderdialog.cpp 60 + +++ b/qt/lc_renderdialog.cpp 61 + @@ -184,7 +184,7 @@ void lcRenderDialog::on_RenderButton_clicked() 62 + #endif 63 + 64 + #ifdef Q_OS_LINUX 65 + - POVRayPath = lcGetProfileString(LC_PROFILE_POVRAY_PATH); 66 + + POVRayPath = QDir::cleanPath(QLatin1String("@povray@/bin/povray")); 67 + Arguments.append("+FN"); 68 + Arguments.append("-D"); 69 + #endif 70 + -- 71 + 2.33.0 72 +