Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkgs/by-name/di/digikam/disable-tests-download.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43636fa9b9...e8da76c480 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -208,10 +208,6 @@
# For CI runners to run tests, the following custom target serves to perform the download automatically.
# If the directory "test-data" has already been created, the target becomes a "no-op".
#
- add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/test-data
- COMMENT "Checkout unit-test data repository. Please wait..."
- COMMAND git
- ARGS clone https://invent.kde.org/graphics/digikam-test-data.git ${CMAKE_SOURCE_DIR}/test-data)
add_custom_target(test-data ALL DEPENDS ${CMAKE_SOURCE_DIR}/test-data)

endif()
273 changes: 163 additions & 110 deletions pkgs/by-name/di/digikam/package.nix
Original file line number Diff line number Diff line change
@@ -1,149 +1,202 @@
{ stdenv, config, lib, fetchurl, cmake, doxygen, extra-cmake-modules, wrapGAppsHook3

# For `digitaglinktree`
, perl, sqlite

, libsForQt5

, bison
, boost
, eigen
, exiv2
, ffmpeg_4
, flex
, graphviz
, imagemagick
, lcms2
, lensfun
, libgphoto2
, liblqr1
, libusb1
, libheif
, libGL
, libGLU
, opencv
, pcre
, x265
, jasper

, bash
# For panorama and focus stacking
, enblend-enfuse
, hugin
, gnumake

, cudaSupport ? config.cudaSupport
, cudaPackages ? {}
{
stdenv,
config,
lib,
fetchFromGitLab,
fetchgit,

cmake,
ninja,
extra-cmake-modules,
flex,
bison,
wrapGAppsHook3,

opencv,
libtiff,
libpng,
libjpeg,
libheif,
libjxl,
boost,
lcms2,
expat,
exiv2,
libxml2,
libxslt,
ffmpeg,
jasper,
eigen,
lensfun,
liblqr1,
libgphoto2,
libusb1,
imagemagick,
x265,
libGLX,
libGLU,

kdePackages,

# For `digitaglinktree`
perl,
sqlite,

runtimeShell,
# For panorama and focus stacking
enblend-enfuse,
hugin,
gnumake,
}:

stdenv.mkDerivation rec {
pname = "digikam";
version = "8.3.0";

src = fetchurl {
url = "mirror://kde/stable/${pname}/${version}/digiKam-${version}-1.tar.xz";
hash = "sha256-BbFF/38vIAX6IbxXnBUqsjyBkbZ4/ylEyPBAbWud5tg=";
let
testData = fetchgit {
url = "https://invent.kde.org/graphics/digikam-test-data.git";
rev = "d02dd20b23cc279792325a0f03d21688547a7a59";
fetchLFS = true;
hash = "sha256-SvsmcniDRorwu9x9OLtHD9ftgquyoE5Kl8qDgqi1XdQ=";
};
in

stdenv.mkDerivation (finalAttrs: {
pname = "digikam";
version = "8.4.0";

src = fetchFromGitLab {
domain = "invent.kde.org";
owner = "graphics";
repo = "digikam";
rev = "v${finalAttrs.version}";
hash = "sha256-GJYlxJkvFEXppVk0yC9ojszylfAGt3eBMAjNUu60XDY=";
};

strictDeps = true;
patches = [ ./disable-tests-download.patch ];

depsBuildBuild = [ cmake ];
strictDeps = true;

nativeBuildInputs = [
cmake
doxygen
ninja
extra-cmake-modules
libsForQt5.kdoctools
libsForQt5.wrapQtAppsHook
flex
bison
kdePackages.wrapQtAppsHook
wrapGAppsHook3
] ++ lib.optionals cudaSupport (with cudaPackages; [
cuda_nvcc
]);
];

# Based on <https://www.digikam.org/api/index.html#externaldeps>,
# but it doesn’t have everything, so you also have to check the
# CMake files…
#
# We list non‐Qt dependencies first to override Qt’s propagated
# build inputs.

buildInputs = [
bison
opencv
libtiff
libpng
# TODO: Figure out how on earth to get it to pick up libjpeg8 for
# lossy DNG support.
libjpeg
libheif
libjxl
boost
eigen
exiv2
ffmpeg_4
flex
graphviz
imagemagick
lcms2
expat
exiv2
libxml2
libxslt
# Qt WebEngine uses and propagates FFmpeg, and if it’s a
# different version it causes linker warnings.
#ffmpeg
jasper
eigen
lensfun
libgphoto2
libheif
liblqr1
libgphoto2
libusb1
libGL
libGLU
opencv
pcre
imagemagick
x265
jasper
] ++ (with libsForQt5; [
libkipi
libksane
libqtav

qtbase
qtxmlpatterns
qtsvg
qtwebengine
qtnetworkauth

akonadi-contacts
kcalendarcore
kconfigwidgets
kcoreaddons
kfilemetadata
knotifications
knotifyconfig
ktextwidgets
kwidgetsaddons
kxmlgui

breeze-icons
marble
oxygen
threadweaver
]) ++ lib.optionals cudaSupport (with cudaPackages; [
cuda_cudart
]);
libGLX
libGLU

kdePackages.qtbase
kdePackages.qtnetworkauth
kdePackages.qtscxml
kdePackages.qtsvg
kdePackages.qtwebengine
kdePackages.qt5compat
kdePackages.qtmultimedia

kdePackages.kconfig
kdePackages.kxmlgui
kdePackages.ki18n
kdePackages.kwindowsystem
kdePackages.kservice
kdePackages.solid
kdePackages.kcoreaddons
kdePackages.knotifyconfig
kdePackages.knotifications
kdePackages.threadweaver
kdePackages.kiconthemes
kdePackages.kfilemetadata
kdePackages.kcalendarcore
kdePackages.kio
kdePackages.sonnet
# libksane and akonadi-contacts do not yet work when building for
# Qt 6.
];

checkInputs = [ kdePackages.qtdeclarative ];

postConfigure = lib.optionalString finalAttrs.doCheck ''
ln -s ${testData} $cmakeDir/test-data
'';

postPatch = ''
substituteInPlace \
core/dplugins/bqm/custom/userscript/userscript.cpp \
core/utilities/import/backend/cameracontroller.cpp \
--replace-fail \"/bin/bash\" \"${lib.getExe bash}\"
--replace-fail '"/bin/bash"' ${lib.escapeShellArg "\"${runtimeShell}\""}
'';

cmakeFlags = [
"-DENABLE_MYSQLSUPPORT=1"
"-DENABLE_INTERNALMYSQL=1"
"-DENABLE_MEDIAPLAYER=1"
"-DENABLE_QWEBENGINE=on"
"-DENABLE_APPSTYLES=on"
"-DCMAKE_CXX_FLAGS=-I${libsForQt5.libksane}/include/KF5" # fix `#include <ksane_version.h>`
(lib.cmakeBool "BUILD_WITH_QT6" true)
(lib.cmakeBool "ENABLE_KFILEMETADATASUPPORT" true)
#(lib.cmakeBool "ENABLE_AKONADICONTACTSUPPORT" true)
(lib.cmakeBool "ENABLE_MEDIAPLAYER" true)
(lib.cmakeBool "ENABLE_APPSTYLES" true)
];

# Tests segfault for some reason…
# TODO: Get them working.
doCheck = false;

dontWrapGApps = true;

preFixup = ''
qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
qtWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ gnumake hugin enblend-enfuse ]})
qtWrapperArgs+=(--suffix DK_PLUGIN_PATH : ${placeholder "out"}/${libsForQt5.qtbase.qtPluginPrefix}/${pname})
qtWrapperArgs+=(--prefix PATH : ${
lib.makeBinPath [
gnumake
hugin
enblend-enfuse
]
})
qtWrapperArgs+=(--suffix DK_PLUGIN_PATH : ${placeholder "out"}/${kdePackages.qtbase.qtPluginPrefix}/digikam)
substituteInPlace $out/bin/digitaglinktree \
--replace "/usr/bin/perl" "${perl}/bin/perl" \
--replace "/usr/bin/sqlite3" "${sqlite}/bin/sqlite3"
'';

meta = with lib; {
description = "Photo Management Program";
license = licenses.gpl2;
homepage = "https://www.digikam.org";
maintainers = with maintainers; [ ];
platforms = platforms.linux;
meta = {
description = "Photo management application";
homepage = "https://www.digikam.org/";
changelog = "${finalAttrs.src.meta.homepage}-/blob/master/project/NEWS.${finalAttrs.version}";
sourceProvenance = [ lib.sourceTypes.fromSource ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sourceProvenance = [ lib.sourceTypes.fromSource ];

https://nixos.org/manual/nixpkgs/unstable/#sec-meta-sourceProvenance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see that this is technically a semantic no‐op according to the manual, but it’s intended to be a forward‐looking change: defining a sourceProvenance list conveys something different to using the default, because it implies a best-effort attempt at exhaustively outlining the provenance; hopefully, in the future, we can change the semantics so that an explicitly‐defined sourceProvenance is intended to convey something exhaustive, like license is, and at that point there would be a desire to annotate from‐source packages like this which I’m trying to get ahead of. Especially since there are definitely non‐source packages out there with no annotation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to get consensus before explicitly contradicting the manual.
And then the manual should be updated in that case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The manual doesn’t say that you shouldn’t define sourceProvenance like this. It just says that it currently doesn’t mean anything more than the empty string. But to humans, it clearly does, I think.

Do you mind if I ask on Matrix for opinions about this? If people are strongly against having this in there then I can remove it, but I do suspect we’re going to hopefully end up in a world where we expect everything to define sourceProvenance and I’d rather document it now than for there to be one more package that will need inspection and annotation later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a package contains elements that are not built from the original source by a nixpkgs derivation, the meta.sourceProvenance attribute should be a list containing one or more value from lib.sourceTypes defined in nixpkgs/lib/source-types.nix.

If we're expecting people to document this even for packages built from source, this bit needs to be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn’t say expected; I just don’t think it’s harmful in any way, and provides some benefit. To quote @toonn on Matrix:

I think it can only be helpful, not harmful. Don't even think the manual has to change, it says "if binary then SHOULD..." that says nothing about "if not binary," so it leaves it open to whatever the package maintainer feels like.
Unless it's a lie of course, then it could be harmful.

As an analogy, consider licensing – we assume the best by default, so license = lib.licenses.free; is technically redundant, but it’s clearly more valuable to have that declaration than not, even if it has no strict semantic effect: it makes it clear that someone has thought about what licence the package is under and thinks it qualifies as FOSS. In the future, we may want to be more strict, requiring packages to list a license (perhaps with a treewide sweep for ones that don’t), and not assuming that packages with no licence declared are FOSS (as it has been wrong in the past); in that case, we’d be grateful for people who specified license = lib.licenses.free;. In my view, the exact same situation applies here, and I don’t think that’s in contradiction to what the manual says at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To put it another way: If “from source” is assumed by default, and omission from the list is not a statement of absence, then why have fromSource at all, as it never conveys any additional information per the semantics given in the manual? Because it’s still providing more information that can be useful to readers now and policy in the future.

Copy link
Contributor

@khaneliman khaneliman Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a package contains elements that are not built from the original source by a nixpkgs derivation, the meta.sourceProvenance attribute should be a list containing one or more value from lib.sourceTypes defined in nixpkgs/lib/source-types.nix.

If we're expecting people to document this even for packages built from source, this bit needs to be changed.

That reads, to me, like it's just explaining how you'd define things that are not built from source and that it may be multiple source types. Not that you shouldn't use it when it is built from source.

license = lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = lib.platforms.linux;
mainProgram = "digikam";
};
}
})
Loading