How to build digikam?

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.

Since you already copied the default.nix, just add separateDebugInfo = true; to the derivation.

If you didn’t, you could use overrideAttrs from the CLI, but at that point you’re so far into doing stuff from the CLI you should not I would suggest just writing the expression into a file.

Thanks. I added that to the build (after dontWrapGApps = true;). Running digikam runs a script that sets up a bunch of environment variables before calling .digikam-wrapped, which doesn’t have debugging symbols. Am I putting the directive in the wrong place?

Interestingly, if I run the commands in the digikam script, then run .digikam-wrapped directly, the program behave properly. If I run the digikam script, it does not.

  • Interestingly, if I run the commands in the digikam script, then run .digikam-wrapped directly, the program behave properly. If I run the digikam script, it does not.*

Scratch that–I haven’t been able to reproduce that behaviour.

I still haven’t been able to get a build with debugging symbols.

I thought I’d try building at various points in the git history to try to identify when the problem was introduced, but I’m not having any luck with that, either.

If I revert my flake.nix to take from git revision 51d906d2341c9e866e48c2efcaac0f2d70bfd43e, and do a home-manager switch --flake..., digikam works.

If I do a nix flake update, then home-manager switch..., digikam does not work, but the previous version does.

If I again revert, the new version still does not work (but the old one does).

With the reverted home manager, I can build (as described above) from source from either the original or more recent git revision, and they work.

If I again update home manager to the recent revision, digikam does not work, but the versions I build while the old home manger was in use still work.

I strongly suspect something outside the digikam package is causing this behaviour, but I don’t know how to track it down.

I’ve been able to identify the first commit (on the nixpkgs-unstable branch) where the problem appears.

Rev 9ed63709bc3cadecbd4484e24f0f7ed47188b464 works
Rev 120a26f8ce32ac2bdc0e49a9fed830b7446416b4 does not