1 { stdenv, lib, perl, cmake, ninja, writeText }:
3 { self, srcs, patches ? [ ] }:
9 version = args.version or srcs.${pname}.version;
10 src = args.src or srcs.${pname}.src;
12 stdenv.mkDerivation (args // {
13 inherit pname version src;
14 patches = args.patches or patches.${pname} or [ ];
16 buildInputs = args.buildInputs or [ ];
17 nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
23 propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]);
26 . ${./hooks/move-qt-dev-tools.sh}
27 . ${./hooks/fix-qt-builtin-paths.sh}
30 outputs = args.outputs or [ "out" "dev" ];
32 dontWrapQtApps = args.dontWrapQtApps or true;
34 if [ ! -z "$dev" ]; then
36 for dir in bin libexec mkspecs
38 moveToOutput "$dir" "$dev"
41 fixQtBuiltinPaths $out/lib "*.pr?"
42 ${args.postInstall or ""}
45 preConfigure = args.preConfigure or "" + ''
46 fixQtBuiltinPaths . '*.pr?'
47 '' + lib.optionalString (builtins.compareVersions "5.15.0" version <= 0)
48 # Note: We use ${version%%-*} to remove any tag from the end of the version
49 # string. Version tags are added by Nixpkgs maintainers and not reflected in
52 if [[ -z "$dontCheckQtModuleVersion" ]] \
53 && grep -q '^MODULE_VERSION' .qmake.conf 2>/dev/null \
54 && ! grep -q -F "''${version%%-*}" .qmake.conf 2>/dev/null
56 echo >&2 "error: could not find version ''${version%%-*} in .qmake.conf"
57 echo >&2 "hint: check .qmake.conf and update the package version in Nixpkgs"
61 if [[ -z "$dontSyncQt" && -f sync.profile ]]; then
62 # FIXME: this probably breaks crosscompiling as it's not from nativeBuildInputs
63 # I don't know how to get /libexec from nativeBuildInputs to work, it's not under /bin
64 ${self.qtbase.dev.nativeDrv or self.qtbase.dev}/libexec/syncqt.pl -version "''${version%%-*}"
69 if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
70 find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
72 -e "/^prefix=/ c prefix=''${!outputLib}" \
73 -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \
74 -e "/^includedir=/ c includedir=''${!outputDev}/include"
79 '' + args.postFixup or "";
82 homepage = "https://www.qt.io/";
83 description = "A cross-platform application framework for C++";
84 license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
85 maintainers = with maintainers; [ milahu nickcao ];
86 platforms = platforms.linux;
87 } // (args.meta or { });