1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-02-19 17:39:34 +00:00

enpass: fix install to work with browser extensions

This commit is contained in:
Guillaume Koenig 2016-12-04 17:25:35 +01:00 committed by Graham Christensen
parent eb01090301
commit 0465b1407b
No known key found for this signature in database
GPG key ID: 06121D366FE9435C

View file

@ -1,7 +1,8 @@
{stdenv, system, fetchurl, dpkg, openssl, xorg {stdenv, system, fetchurl, dpkg, openssl, xorg
, glib, mesa, libpulseaudio, zlib, dbus, fontconfig, freetype , glib, mesa, libpulseaudio, zlib, dbus, fontconfig, freetype
, gtk2, pango, atk, cairo, gdk_pixbuf, jasper, xkeyboardconfig , gtk2, pango, atk, cairo, gdk_pixbuf, jasper, xkeyboardconfig
, makeWrapper , makeDesktopItem, python, pythonPackages, lib}: , makeWrapper , makeDesktopItem, python, pythonPackages, lib
, libredirect, lsof}:
assert system == "i686-linux" || system == "x86_64-linux"; assert system == "i686-linux" || system == "x86_64-linux";
let let
all_data = (with builtins; fromJSON (readFile ./data.json)); all_data = (with builtins; fromJSON (readFile ./data.json));
@ -13,7 +14,7 @@ let
data = (with builtins; getAttr (getAttr system system_map) all_data); data = (with builtins; getAttr (getAttr system system_map) all_data);
baseUrl = http://repo.sinew.in; baseUrl = http://repo.sinew.in;
# used of both wrappers and libpath # used of both wrappers and libpath
libPath = lib.makeLibraryPath (with xorg; [ libPath = lib.makeLibraryPath (with xorg; [
openssl openssl
@ -66,28 +67,34 @@ let
cp -r opt/Enpass/* $out cp -r opt/Enpass/* $out
cp -r usr/* $out cp -r usr/* $out
rm $out/bin/runenpass.sh rm $out/bin/runenpass.sh
cp $out/bin/EnpassHelper/EnpassHelper{,.untampered}
sed \ sed \
-i s@/opt/Enpass/bin/runenpass.sh@$out/bin/Enpass@ \ -i s@/opt/Enpass/bin/runenpass.sh@$out/bin/Enpass@ \
$out/share/applications/enpass.desktop $out/share/applications/enpass.desktop
patchelf \ for i in $out/bin/{Enpass,EnpassHelper/EnpassHelper}; do
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i
$out/bin/Enpass done
# The helper's sha256 sum must match, hence the use of libredirect.
# Also, lsof must be in the path for proper operation.
wrapProgram $out/bin/Enpass \ wrapProgram $out/bin/Enpass \
--set LD_LIBRARY_PATH "${libPath}:$out/lib:$out/plugins/sqldrivers" \ --set LD_LIBRARY_PATH "${libPath}:$out/lib:$out/plugins/sqldrivers" \
--set QT_PLUGIN_PATH "$out/plugins" \ --set QT_PLUGIN_PATH "$out/plugins" \
--set QT_QPA_PLATFORM_PLUGIN_PATH "$out/plugins/platforms" \ --set QT_QPA_PLATFORM_PLUGIN_PATH "$out/plugins/platforms" \
--set QT_XKB_CONFIG_ROOT "${xkeyboardconfig}/share/X11/xkb" \ --set QT_XKB_CONFIG_ROOT "${xkeyboardconfig}/share/X11/xkb" \
--set HIDE_TOOLBAR_LINE 0 --set HIDE_TOOLBAR_LINE 0 \
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS "$out/bin/EnpassHelper/EnpassHelper=$out/bin/EnpassHelper/EnpassHelper.untampered" \
--prefix PATH : ${lsof}/bin
''; '';
}; };
updater = { updater = {
update = stdenv.mkDerivation rec { update = stdenv.mkDerivation rec {
name = "enpass-update-script"; name = "enpass-update-script";
SCRIPT =./update_script.py; SCRIPT =./update_script.py;
buildInputs = with pythonPackages; [python requests pathlib2 six attrs ]; buildInputs = with pythonPackages; [python requests pathlib2 six attrs ];
shellHook = '' shellHook = ''
exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl} exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl}
@ -95,4 +102,4 @@ let
}; };
}; };
in (package // {refresh = updater;}) in (package // {refresh = updater;})