From 591fd5344851aa7b183cc64478d6ae6780dc5ceb Mon Sep 17 00:00:00 2001 From: whoomee Date: Thu, 13 Aug 2026 14:42:20 +0200 Subject: [PATCH 1/5] libcamera: switch to fetchFromGitLab Using fetchFromGitLab allows nix-update to autodetect the latest version. --- pkgs/by-name/li/libcamera/package.nix | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index 403a2f70c0bf..f201fa0f1950 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -1,6 +1,7 @@ { stdenv, - fetchgit, + fetchFromGitLab, + nix-update-script, lib, meson, ninja, @@ -31,13 +32,15 @@ SDL2, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libcamera"; version = "0.7.2"; - src = fetchgit { - url = "https://git.libcamera.org/libcamera/libcamera.git"; - rev = "v${version}"; + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "camera"; + repo = "libcamera"; + tag = "v${finalAttrs.version}"; hash = "sha256-vhFkeT1j2KKm+CVvGrtH5BEYJSEdaX7N7DRdA0a9EWk="; }; @@ -151,10 +154,13 @@ stdenv.mkDerivation rec { FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; }; + passthru.updateScript = nix-update-script { }; + meta = { description = "Open source camera stack and framework for Linux, Android, and ChromeOS"; homepage = "https://libcamera.org"; - changelog = "https://git.libcamera.org/libcamera/libcamera.git/tag/?h=${src.rev}"; + downloadPage = "https://gitlab.freedesktop.org/camera/libcamera"; + changelog = "https://gitlab.freedesktop.org/camera/libcamera/-/releases/${finalAttrs.src.tag}"; license = lib.licenses.lgpl2Plus; maintainers = with lib.maintainers; [ citadelcore ]; platforms = lib.platforms.linux; @@ -163,4 +169,4 @@ stdenv.mkDerivation rec { lib.systems.inspect.platformPatterns.isStatic ]; }; -} +}) From 7a74f484f13a22cdfbb2fd3d82fa846223265fd2 Mon Sep 17 00:00:00 2001 From: whoomee Date: Thu, 13 Aug 2026 14:42:57 +0200 Subject: [PATCH 2/5] libcamera: add maintainer tmarkus --- pkgs/by-name/li/libcamera/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index f201fa0f1950..a2c70f40200c 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -162,7 +162,10 @@ stdenv.mkDerivation (finalAttrs: { downloadPage = "https://gitlab.freedesktop.org/camera/libcamera"; changelog = "https://gitlab.freedesktop.org/camera/libcamera/-/releases/${finalAttrs.src.tag}"; license = lib.licenses.lgpl2Plus; - maintainers = with lib.maintainers; [ citadelcore ]; + maintainers = with lib.maintainers; [ + citadelcore + tmarkus + ]; platforms = lib.platforms.linux; badPlatforms = [ # Mandatory shared libraries. From bfbfe2f22ccf3df42fb6111eeeb44ebbc191a89c Mon Sep 17 00:00:00 2001 From: whoomee Date: Thu, 13 Aug 2026 16:07:37 +0200 Subject: [PATCH 3/5] libcamera: specify and test meta.pkgConfigModules --- pkgs/by-name/li/libcamera/package.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index a2c70f40200c..4673c899a7a8 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -1,6 +1,7 @@ { stdenv, fetchFromGitLab, + testers, nix-update-script, lib, meson, @@ -154,7 +155,11 @@ stdenv.mkDerivation (finalAttrs: { FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; }; - passthru.updateScript = nix-update-script { }; + passthru = { + updateScript = nix-update-script { }; + + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; meta = { description = "Open source camera stack and framework for Linux, Android, and ChromeOS"; @@ -162,6 +167,10 @@ stdenv.mkDerivation (finalAttrs: { downloadPage = "https://gitlab.freedesktop.org/camera/libcamera"; changelog = "https://gitlab.freedesktop.org/camera/libcamera/-/releases/${finalAttrs.src.tag}"; license = lib.licenses.lgpl2Plus; + pkgConfigModules = [ + "libcamera" + "libcamera-base" + ]; maintainers = with lib.maintainers; [ citadelcore tmarkus From 97b876dfe0efe1bbae09a4d5a9d0123239407b54 Mon Sep 17 00:00:00 2001 From: whoomee Date: Sun, 16 Aug 2026 19:55:30 +0200 Subject: [PATCH 4/5] libcamera: refactor mesonFlags --- pkgs/by-name/li/libcamera/package.nix | 60 +++++++++++++++------------ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index 4673c899a7a8..00a1c5052e4f 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -15,13 +15,14 @@ libyuv, gst_all_1, gtest, - graphviz, - doxygen, python3, python3Packages, udev, libpisp, libglvnd, + enableDocumentation ? false, + graphviz, + doxygen, withTracing ? lib.meta.availableOn stdenv.hostPlatform lttng-ust, lttng-ust, # withTracing withSoftispGPU ? true, # software ISP GPU acceleration @@ -116,36 +117,43 @@ stdenv.mkDerivation (finalAttrs: { python3Packages.jinja2 python3Packages.pyyaml python3Packages.ply + openssl + ] + ++ lib.optionals enableDocumentation [ python3Packages.sphinx graphviz doxygen - openssl ] ++ lib.optional withQcam qt6.wrapQtAppsHook; - mesonFlags = [ - (lib.mesonEnable "v4l2" true) - (lib.mesonEnable "tracing" withTracing) - (lib.mesonEnable "qcam" withQcam) - (lib.mesonEnable "apps-output-dng" withQcam) - (lib.mesonEnable "cam-output-sdl2" withQcam) - (lib.mesonEnable "cam-jpeg" withQcam) - (lib.mesonEnable "softisp-gpu" withSoftispGPU) - (lib.mesonEnable "libunwind" false) - (lib.mesonEnable "libdw" false) - (lib.mesonEnable "lc-compliance" false) # tries unconditionally to download gtest when enabled - # Avoid blanket -Werror to evade build failures on less - # tested compilers. - (lib.mesonBool "werror" false) - # Documentation breaks binary compatibility. - # Given that upstream also provides public documentation, - # we can disable it here. - (lib.mesonEnable "documentation" false) - ] - ++ lib.optionals stdenv.hostPlatform.isAarch [ - # we don't have tensorflow-lite to build this - (lib.mesonEnable "rpi-awb-nn" false) - ]; + mesonFlags = + lib.mapAttrsToList lib.mesonEnable { + v4l2 = true; + tracing = true; + pycamera = true; + qcam = withQcam; + apps-output-dng = withQcam; + cam-output-sdl2 = withQcam; + cam-jpeg = withQcam; + softisp-gpu = withSoftispGPU; + libunwind = false; + libdw = false; + lc-compliance = false; # tries unconditionally to download gtest when enabled + + # Documentation breaks binary compatibility. + # Given that upstream also provides public documentation, + # we can disable it here. + documentation = enableDocumentation; + + rpi-awb-nn = false; + } + ++ [ + (lib.mesonBool "test" finalAttrs.finalPackage.doCheck) + + # Avoid blanket -Werror to evade build failures on less + # tested compilers. + (lib.mesonBool "werror" false) + ]; env = { # Fixes error on a deprecated declaration From 2cb012041b6aab958db3ca02932767dce319ba6d Mon Sep 17 00:00:00 2001 From: whoomee Date: Sun, 16 Aug 2026 19:56:55 +0200 Subject: [PATCH 5/5] libcamera: re-enable lc-compliance The comment specifying that it doesn't work is not applicable anymore. --- pkgs/by-name/li/libcamera/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index 00a1c5052e4f..ccc88e65e3c5 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -138,7 +138,7 @@ stdenv.mkDerivation (finalAttrs: { softisp-gpu = withSoftispGPU; libunwind = false; libdw = false; - lc-compliance = false; # tries unconditionally to download gtest when enabled + lc-compliance = true; # Documentation breaks binary compatibility. # Given that upstream also provides public documentation,