diff options
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/default.nix | 1 | ||||
-rw-r--r-- | pkgs/show-qr-code/default.nix | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix index 9e1b0d6e..d7057820 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -17,6 +17,7 @@ let librxtx_java = callPackage ./librxtx-java { }; lockdev = callPackage ./lockdev { }; pvolctrl = callPackage ./pvolctrl { }; + show-qr-code = callPackage ./show-qr-code { }; sidplayfp = callPackage ./sidplayfp { }; tkabber_urgent_plugin = callPackage ./tkabber-urgent-plugin { }; tomahawk = callPackage ./tomahawk { qt5 = pkgs.qt55; }; diff --git a/pkgs/show-qr-code/default.nix b/pkgs/show-qr-code/default.nix new file mode 100644 index 00000000..17d9847a --- /dev/null +++ b/pkgs/show-qr-code/default.nix @@ -0,0 +1,28 @@ +{ stdenv, writeScriptBin, gtkdialog, qrencode }: + +let script = writeScriptBin "show-qr-code" '' + #!/bin/sh + TMP=$(mktemp) + ${qrencode}/bin/qrencode -s 8 -o "$TMP" -t PNG "$1" + + export DIALOG=' + <vbox> + <pixmap> + <input file>'$TMP'</input> + </pixmap> + </vbox> + ' + + ${gtkdialog}/bin/gtkdialog --program=DIALOG > /dev/null & + + sleep 0.2 + + rm "$TMP" + + ''; + +in script // { + meta = { + description = "Show the given string as qr code in a gtk window"; + }; +} |