2016-09-19 16:50:52 +00:00
|
|
|
{stdenv, system, fetchurl, dpkg, openssl, xorg
|
2018-02-24 13:12:44 +00:00
|
|
|
, glib, libGLU_combined, libpulseaudio, zlib, dbus, fontconfig, freetype
|
2016-09-19 16:50:52 +00:00
|
|
|
, gtk2, pango, atk, cairo, gdk_pixbuf, jasper, xkeyboardconfig
|
2016-12-04 16:25:35 +00:00
|
|
|
, makeWrapper , makeDesktopItem, python, pythonPackages, lib
|
|
|
|
, libredirect, lsof}:
|
2016-09-19 16:50:52 +00:00
|
|
|
assert system == "i686-linux" || system == "x86_64-linux";
|
|
|
|
let
|
|
|
|
all_data = (with builtins; fromJSON (readFile ./data.json));
|
|
|
|
system_map = {
|
|
|
|
i686-linux = "i386";
|
|
|
|
x86_64-linux = "amd64";
|
|
|
|
};
|
|
|
|
|
|
|
|
data = (with builtins; getAttr (getAttr system system_map) all_data);
|
|
|
|
|
|
|
|
baseUrl = http://repo.sinew.in;
|
2016-12-04 16:25:35 +00:00
|
|
|
|
2016-09-19 16:50:52 +00:00
|
|
|
# used of both wrappers and libpath
|
|
|
|
libPath = lib.makeLibraryPath (with xorg; [
|
|
|
|
openssl
|
2018-02-24 13:12:44 +00:00
|
|
|
libGLU_combined
|
2016-09-19 16:50:52 +00:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
libpulseaudio
|
|
|
|
zlib
|
|
|
|
dbus
|
|
|
|
libX11
|
|
|
|
libXi
|
|
|
|
libSM
|
|
|
|
libICE
|
|
|
|
libXext
|
|
|
|
libXrender
|
|
|
|
libXScrnSaver
|
|
|
|
glib
|
|
|
|
gtk2
|
|
|
|
pango
|
|
|
|
cairo
|
|
|
|
atk
|
|
|
|
gdk_pixbuf
|
|
|
|
jasper
|
|
|
|
stdenv.cc.cc
|
|
|
|
]);
|
|
|
|
package = stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
inherit (data) version;
|
|
|
|
name = "enpass-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
inherit (data) sha256;
|
|
|
|
url = "${baseUrl}/${data.path}";
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "a well known password manager";
|
|
|
|
homepage = https://www.enpass.io/;
|
|
|
|
license = lib.licenses.unfree;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [makeWrapper dpkg];
|
|
|
|
phases = [ "unpackPhase" "installPhase" ];
|
|
|
|
|
|
|
|
unpackPhase = "dpkg -X $src .";
|
|
|
|
installPhase=''
|
|
|
|
mkdir $out
|
|
|
|
cp -r opt/Enpass/* $out
|
2016-12-27 13:23:16 +00:00
|
|
|
cp -r usr/* $out
|
|
|
|
rm $out/bin/runenpass.sh
|
2016-12-04 16:25:35 +00:00
|
|
|
cp $out/bin/EnpassHelper/EnpassHelper{,.untampered}
|
2017-11-30 17:43:39 +00:00
|
|
|
cp $out/bin/EnpassHelper/EnpassNMHost{,.untampered}
|
2016-09-19 16:50:52 +00:00
|
|
|
|
2016-12-27 13:23:16 +00:00
|
|
|
sed \
|
|
|
|
-i s@/opt/Enpass/bin/runenpass.sh@$out/bin/Enpass@ \
|
2016-12-04 16:25:35 +00:00
|
|
|
$out/share/applications/enpass.desktop
|
2016-09-19 16:50:52 +00:00
|
|
|
|
2017-11-30 17:43:39 +00:00
|
|
|
for i in $out/bin/{Enpass,EnpassHelper/{EnpassHelper,EnpassNMHost}}; do
|
2016-12-04 16:25:35 +00:00
|
|
|
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i
|
|
|
|
done
|
2016-09-19 16:50:52 +00:00
|
|
|
|
2016-12-04 16:25:35 +00:00
|
|
|
# The helper's sha256 sum must match, hence the use of libredirect.
|
|
|
|
# Also, lsof must be in the path for proper operation.
|
2016-09-19 16:50:52 +00:00
|
|
|
wrapProgram $out/bin/Enpass \
|
|
|
|
--set LD_LIBRARY_PATH "${libPath}:$out/lib:$out/plugins/sqldrivers" \
|
|
|
|
--set QT_PLUGIN_PATH "$out/plugins" \
|
|
|
|
--set QT_QPA_PLATFORM_PLUGIN_PATH "$out/plugins/platforms" \
|
2016-12-27 13:23:16 +00:00
|
|
|
--set QT_XKB_CONFIG_ROOT "${xkeyboardconfig}/share/X11/xkb" \
|
2016-12-04 16:25:35 +00:00
|
|
|
--set HIDE_TOOLBAR_LINE 0 \
|
|
|
|
--set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
|
2017-11-30 17:43:39 +00:00
|
|
|
--set NIX_REDIRECTS "$out/bin/EnpassHelper/EnpassHelper=$out/bin/EnpassHelper/EnpassHelper.untampered:$out/bin/EnpassHelper/EnpassNMHost=$out/bin/EnpassHelper/EnpassNMHost.untampered" \
|
2016-12-04 16:25:35 +00:00
|
|
|
--prefix PATH : ${lsof}/bin
|
2017-11-30 17:43:39 +00:00
|
|
|
|
|
|
|
makeWrapper $out/bin/EnpassHelper/{EnpassNMHost,runNativeMessaging.sh} \
|
|
|
|
--set LD_LIBRARY_PATH "${libPath}:$out/lib:$out/plugins/sqldrivers" \
|
|
|
|
--set QT_PLUGIN_PATH "$out/plugins" \
|
|
|
|
--set QT_QPA_PLATFORM_PLUGIN_PATH "$out/plugins/platforms" \
|
|
|
|
--set QT_XKB_CONFIG_ROOT "${xkeyboardconfig}/share/X11/xkb" \
|
|
|
|
--set HIDE_TOOLBAR_LINE 0
|
2016-09-19 16:50:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
updater = {
|
|
|
|
update = stdenv.mkDerivation rec {
|
|
|
|
name = "enpass-update-script";
|
|
|
|
SCRIPT =./update_script.py;
|
2016-12-04 16:25:35 +00:00
|
|
|
|
2016-09-19 16:50:52 +00:00
|
|
|
buildInputs = with pythonPackages; [python requests pathlib2 six attrs ];
|
|
|
|
shellHook = ''
|
|
|
|
exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl}
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
2016-12-04 16:25:35 +00:00
|
|
|
in (package // {refresh = updater;})
|