nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 nix-update-script,
6 testers,
7 qmake,
8 qtmultimedia,
9}:
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "qzxing";
13 version = "3.3.0";
14
15 src = fetchFromGitHub {
16 owner = "ftylitak";
17 repo = "qzxing";
18 rev = "v${finalAttrs.version}";
19 hash = "sha256-ASgsF5ocNWAiIy2jm6ygpDkggBcEpno6iVNWYkuWcVI=";
20 };
21
22 # greaterThan/lessThan don't handle versions, use versionAtLeast/versionAtMost instead
23 # Versions are different due to versionAtLeast/-Most using an inclusive limit, while greater-/lessThan use exclusive ones
24 postPatch = ''
25 substituteInPlace src/QZXing-components.pri \
26 --replace-fail 'lessThan(QT_VERSION, 6.2)' 'versionAtMost(QT_VERSION, 6.1)' \
27 --replace-fail 'greaterThan(QT_VERSION, 6.1)' 'versionAtLeast(QT_VERSION, 6.2)'
28 '';
29
30 # QMake can't find qtmultimedia in buildInputs
31 strictDeps = false;
32
33 nativeBuildInputs = [
34 qmake
35 ];
36
37 buildInputs = [
38 qtmultimedia
39 ];
40
41 dontWrapQtApps = true;
42
43 preConfigure = ''
44 cd src
45 '';
46
47 qmakeFlags = [
48 "CONFIG+=qzxing_qml"
49 "CONFIG+=qzxing_multimedia"
50 "QMAKE_PKGCONFIG_PREFIX=${placeholder "out"}"
51 ];
52
53 passthru = {
54 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
55 updateScript = nix-update-script { };
56 };
57
58 meta = {
59 description = "Qt/QML wrapper library for the ZXing library";
60 homepage = "https://github.com/ftylitak/qzxing";
61 license = lib.licenses.asl20;
62 maintainers = with lib.maintainers; [ OPNA2608 ];
63 platforms = lib.platforms.unix;
64 pkgConfigModules = [
65 "QZXing"
66 ];
67 };
68})