Skip to content

Commit

Permalink
zbar: Split to multiple outputs
Browse files Browse the repository at this point in the history
Also fix D-Bus config dir path: The configure script is appending `/dbus-1/system.d`
so when we added passed in `$out/etc/dbus-1/system.d`, it ended up with extra nesting.
  • Loading branch information
jtojnar committed Sep 9, 2019
1 parent 41fbd55 commit e1cb839
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkgs/applications/misc/electrum/default.nix
Expand Up @@ -88,7 +88,7 @@ python3Packages.buildPythonApplication {
--replace ${libsecp256k1_name} ${secp256k1}/lib/libsecp256k1${stdenv.hostPlatform.extensions.sharedLibrary}
'' + (if enableQt then ''
substituteInPlace ./electrum/qrscanner.py \
--replace ${libzbar_name} ${zbar}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
--replace ${libzbar_name} ${zbar.lib}/lib/libzbar${stdenv.hostPlatform.extensions.sharedLibrary}
'' else ''
sed -i '/qdarkstyle/d' contrib/requirements/requirements.txt
'');
Expand Down
11 changes: 7 additions & 4 deletions pkgs/tools/graphics/zbar/default.nix
Expand Up @@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
pname = "zbar";
version = "0.23";

outputs = [ "out" "py" "lib" "dev" "doc" "man" ];

src = fetchFromGitHub {
owner = "mchehab";
repo = "zbar";
Expand Down Expand Up @@ -54,7 +56,7 @@ stdenv.mkDerivation rec {
];

configureFlags = (if enableDbus then [
"--with-dbusconfdir=${placeholder "out"}/etc/dbus-1/system.d"
"--with-dbusconfdir=${placeholder "out"}/etc"
] else [
"--without-dbus"
]) ++ lib.optionals (!enableVideo) [
Expand All @@ -63,9 +65,10 @@ stdenv.mkDerivation rec {
"--without-qt"
];

postInstall = optionalString enableDbus ''
install -Dm644 dbus/org.linuxtv.Zbar.conf $out/etc/dbus-1/system.d/org.linuxtv.Zbar.conf
'';
makeFlags = [
"pyexecdir=${placeholder "py"}/${python.sitePackages}"
"pythondir=${placeholder "py"}/${python.sitePackages}"
];

meta = with lib; {
description = "Bar code reader";
Expand Down
15 changes: 10 additions & 5 deletions pkgs/tools/security/asc-key-to-qr-code-gif/default.nix
Expand Up @@ -15,15 +15,20 @@ stdenv.mkDerivation {
sha256 = "0yrc302a2fhbzryb10718ky4fymfcps3lk67ivis1qab5kbp6z8r";
};

buildInputs = [ imagemagick qrencode ] ++ stdenv.lib.optional testQR zbar;
dontBuild = true;
dontStrip = true;
dontPatchELF = true;

preInstall = ''
substituteInPlace asc-to-gif.sh \
--replace "convert" "${imagemagick}/bin/convert" \
--replace "qrencode" "${qrencode.bin}/bin/qrencode"
preInstall = let
substitutions = [
''--replace "convert" "${imagemagick}/bin/convert"''
''--replace "qrencode" "${qrencode.bin}/bin/qrencode"''
] ++ stdenv.lib.optional testQR [
''--replace "hash zbarimg" "true"'' # hash does not work on NixOS
''--replace "$(zbarimg --raw" "$(${zbar.out}/bin/zbarimg --raw"''
];
in ''
substituteInPlace asc-to-gif.sh ${stdenv.lib.concatStringsSep " " substitutions}
'';

installPhase = ''
Expand Down

0 comments on commit e1cb839

Please sign in to comment.