Nix impurities

From Nix Wiki
Jump to: navigation, search

What can theoretically cause different build results?

  • current date
  • cpu
  • RAM available
  • fileystem
  • kernel running the builds
We have the kernelHeaders. Programs should respect kernelHeaders for the kernel API, and not talk to the running kernel.
  • is a virtualization system being used ?
  • sensors (such as temperature)
  • system-probes or benchmarks (some programs to probe the system and build software according to what cpu they find or how efficient the system is)
  • timing behaviour of any component in use (fs, ..) (causing timeouts and such)
  • parallel building if you enable it. Eg make -jN sometimes fails randomly for some projects
  • gconf runs in daemon mode

Qt impurities


 "Cannot mix incompatible Qt library (version 0x40800) with this library (version 0x40801)"


   Cannot mix incompatible Qt library (version 0x40805) with this library (version 0x40806)
   [1]    14683 abort (core dumped)  anki

the cause

the problem was:

  • /run/current-system/sw/lib/kde4/plugins -> => /nix/store/k83zcpdm4lfmj3190bwjgff0xi0jgysk-qt-4.8.5/lib/ (0x00007f8360c6f000)
  • /nix/store/10rbmywrqqs1migib3jkxrr8207jpylr-kdelibs-4.12.4/lib/kde4/plugins/ -> => /nix/store/k83zcpdm4lfmj3190bwjgff0xi0jgysk-qt-4.8.5/lib/
  • /nix/store/j49b795nhxvc3hyxjkw1q7r6ga0napg5-system-path/lib/kde4/plugins/ -> => /nix/store/10rbmywrqqs1migib3jkxrr8207jpylr-kdelibs-4.12.4/lib/

the temporary solution

to get anki running, temporarily, remove all the above 3 paths from the QT_PLUGIN_PATH like:

export QT_PLUGIN_PATH="/home/joachim/.nix-profile/lib/qt4/plugins:/home/joachim/.nix-profile/lib/kde4/plugins:/nix/var/nix/profiles/default/lib/qt4/plugins:/nix/var/nix/profiles/default/lib/kde4/plugins:/run/current-system/sw/lib/qt4/plugins:/home/joachim/.kde/lib/kde4/plugins/"

the final solution

TBD but QT_PLUGIN_PATH is a global variable and as such problematic. one solution would be to wrap Qt binaries like done for python. another solution would be to write a patch for each Qt version so that QT_PLUGIN_PATH would be named like:


i'd prefer the latter since it is very clean. still i wonder why anki works, maybe it does not use any of the PLUGINS.

runtime impurities

Stateful directories in NixOS: /etc, /var, /home can cause packages to do what they usually do. In case of trouble make a backup, delete and recreate those to trouble shoot a problem.