How to build digikam?

I’m trying to track down a problem with digikam (see Digikam crashing on right-click after upgrade). I’d like to build the package locally for troubleshooting (and to try to upgrade to version 8.2.0).

I’ve created a directory and copied the default.nix from git, but when I run nix-build, I get:

       Nix attempted to evaluate a function as a top level expression; in
       this case it must have its arguments supplied either by default
       values, or passed explicitly with '--arg' or '--argstr'. See
       https://nixos.org/manual/nix/stable/language/constructs.html#functions.

       at /home/mike/src/digikam/default.nix:1:43:

            1| {  mkDerivation, config, lib, fetchpatch, fetchurl, cmake, doxygen, extra-cmake-modules, wrapGAppsHook
             |                                           ^
            2|```

try this nix-build -E '(import <nixpkgs> {}).libsForQt5.callPackage ./default.nix {}'

edit: include libsForQt5

Nix Pill on callPackage

Thanks! Is there a . missing after the right paren? When I add that, I get:

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'digikam-8.1.0'
         whose name attribute is located at /nix/store/cghziybin05ridg1w8pdvp66kfvr3pma-nixos-22.05.998.d17a56d90ec/nixos/pkgs/stdenv/generic/make-derivation.nix:278:7

       … while evaluating attribute 'buildInputs' of derivation 'digikam-8.1.0'

         at /nix/store/cghziybin05ridg1w8pdvp66kfvr3pma-nixos-22.05.998.d17a56d90ec/nixos/pkgs/stdenv/generic/make-derivation.nix:322:7:

          321|       depsHostHost                = lib.elemAt (lib.elemAt dependencies 1) 0;
          322|       buildInputs                 = lib.elemAt (lib.elemAt dependencies 1) 1;
             |       ^
          323|       depsTargetTarget            = lib.elemAt (lib.elemAt dependencies 2) 0;

       error: attribute 'cudaSupport' missing

       at /home/mike/src/digikam/default.nix:57:17:

           56|
           57| , cudaSupport ? config.cudaSupport
             |                 ^
           58| , cudaPackages ? {}```

whoops, yes. edited my post. My build errors with:

CMake Error at core/libs/metadataengine/CMakeLists.txt:106 (include_directories):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:exiv2lib,INTERFACE_INCLUDE_DIRECTORIES>

  Target "exiv2lib" not found.

Edit: This was on my laptop and copied default.nix from a forked nixpkgs whoops

When using callPackage, you can choose to pass in a different variant, e.g.
when a different version of the toolkit suffices

mypkg = callPackage { cudaPackages = cudaPackages_11_5; }

Might help? See https://github.com/ttuegel/nixpkgs/blob/81aa88d4c485c0f41e4d3515508726ed750e936e/doc/languages-frameworks/cuda.section.md

which version of NixOS are you running by chance? 22.05?

I’m running 23.11 for the system, and unstable for use packages.

I don’t understand how to specify cudaPackages for the build.

hmm. I’m building it with a locally cloned nixpkgs since I’m on a flakes setup. Perhaps there’s a mismatch with your channels and packages? I just tried this morning and it builds fine:

nix-build -I nixpkgs=/home/rjpc/git/nixpkgs blah blah

rjpc /tmp/junk/result/bin % ./digikam --help   
Usage: ./digikam [options]
Professional Photo Management with the Power of Open Source - A KDE Family Project

Options:
  -h, --help                  Displays help on commandline options.
  --help-all                  Displays help including Qt specific options.
  -v, --version               Displays version information.

Might be worth showing us output of nix-shell -p nix-info --run "nix-info -m"

I’m also gonna ping @TLATER since they might be able to help?

That command returns:

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.68, NixOS, 23.11 (Tapir), 23.11.20231220.d65bcea`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos````

I'm also using flakes. I'm taking my system from 23.11, but using "unstable" for my user packages.

I’m not sure of the flakes way of using nix build tbh. If anyone does please share :slight_smile:

Could you try shallow cloning nixpkgs and building it that way as I did above (via -I)?

I’ve cloned the repo, but am not sure what to do next. Do I need to build everything? What directory should I be in, and what command do I run–i.e., what should I replace blah blah with in your command: nix-build -I nixpkgs=/home/rjpc/git/nixpkgs blah blah?

From ~//src/nixpkgs/pkgs/applications/graphics/digikam I run:

nix-build -I /home/mike/src/nixpkgs/ -E '(import <nixpkgs> {}).libsForQt5.callPackage ./default.nix {}'

I get:

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'digikam-8.1.0'
         whose name attribute is located at /nix/store/cghziybin05ridg1w8pdvp66kfvr3pma-nixos-22.05.998.d17a56d90ec/nixos/pkgs/stdenv/generic/make-derivation.nix:278:7

       … while evaluating attribute 'buildInputs' of derivation 'digikam-8.1.0'

         at /nix/store/cghziybin05ridg1w8pdvp66kfvr3pma-nixos-22.05.998.d17a56d90ec/nixos/pkgs/stdenv/generic/make-derivation.nix:322:7:

          321|       depsHostHost                = lib.elemAt (lib.elemAt dependencies 1) 0;
          322|       buildInputs                 = lib.elemAt (lib.elemAt dependencies 1) 1;
             |       ^
          323|       depsTargetTarget            = lib.elemAt (lib.elemAt dependencies 2) 0;

       error: attribute 'cudaSupport' missing

       at /home/mike/src/nixpkgs/pkgs/applications/graphics/digikam/default.nix:57:17:

           56|
           57| , cudaSupport ? config.cudaSupport
             |                 ^
           58| , cudaPackages ? {}```

The cudaSupport thing is part of top-level/config.nix. Normally that’s supposed to be imported as part of import <nixpkgs> { }, but it looks like that’s not happening here for some reason. Probably a bug?

Try these as a workaround for now:

nix-build -I /home/mike/src/nixpkgs/ -E '(import <nixpkgs> { config = { cudaSupport = false; }; }).libsForQt5.callPackage ./default.nix {  }'
nix-build -I /home/mike/src/nixpkgs/ -E '(import <nixpkgs> { }; }).libsForQt5.callPackage ./default.nix {  config = { cudaSupport = false; } }'
1 Like
nix build .#digikam

in your checkout of nixpkgs should do it. Or just nix build nixpkgs#digikam to let nix do the checkout for you.

@mikelygee

Was just about to come back and type

nix-build -I nixpkgs=/home/mike/src/nixpkgs -E '(import <nixpkgs> {}).libsForQt5.callPackage ./default.nix { cudaSupport = true; }

the above should also work along with the commands @TLATER wrote. I’m running this right now and my CPU is getting hot
edit: built successfully! I hope it works for you also.

oh nice, so easy. Thanks! How can one pass options like cudaSupport with nix build nixpkgs#blah sorry if this is a silly syntax question.

1 Like

You can do that with the --expr arg: nix build - Nix Reference Manual

1 Like

That first “workaround” line has it building–thanks! We’ll see where that leads me.

1 Like

It builds, and the executable exhibits the problem I’m trying to troubleshoot. How can I get it to build with debug symbols, so I can use gdb to figure out what’s going on?

Might find that answer here Adding debug symbols to package from nixpkgs - #3 by danieldk

Thanks. I can’t figure out how to incorporate enableDebugging into the command line.