nixpkgs/pkgs/tools/security/enpass/default.nix

95 lines
2.2 KiB
Nix
Raw Normal View History

2019-01-11 21:32:00 +00:00
{ stdenv, fetchurl, dpkg, xorg
, glib, libGLU_combined, libpulseaudio, zlib, dbus, fontconfig, freetype
2019-01-11 21:32:00 +00:00
, gtk3, pango
, makeWrapper , python, pythonPackages, lib
, lsof, curl, libuuid, cups, mesa
}:
2016-09-19 16:50:52 +00:00
let
all_data = builtins.fromJSON (builtins.readFile ./data.json);
2016-09-19 16:50:52 +00:00
system_map = {
2019-01-11 21:32:00 +00:00
# i686-linux = "i386"; Uncomment if enpass 6 becomes available on i386
2016-09-19 16:50:52 +00:00
x86_64-linux = "amd64";
};
data = all_data.${system_map.${stdenv.hostPlatform.system} or (throw "Unsupported platform")};
2016-09-19 16:50:52 +00:00
baseUrl = http://repo.sinew.in;
2016-09-19 16:50:52 +00:00
# used of both wrappers and libpath
libPath = lib.makeLibraryPath (with xorg; [
mesa.drivers
libGLU_combined
2016-09-19 16:50:52 +00:00
fontconfig
freetype
libpulseaudio
zlib
dbus
libX11
libXi
libSM
libICE
libXrender
libXScrnSaver
2019-01-11 21:32:00 +00:00
libxcb
2016-09-19 16:50:52 +00:00
glib
2019-01-11 21:32:00 +00:00
gtk3
2016-09-19 16:50:52 +00:00
pango
2019-01-11 21:32:00 +00:00
curl
libuuid
cups
2016-09-19 16:50:52 +00:00
]);
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 = [ "x86_64-linux" "i686-linux"];
2016-09-19 16:50:52 +00:00
};
buildInputs = [makeWrapper dpkg];
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = "dpkg -X $src .";
installPhase=''
2019-01-11 21:32:00 +00:00
mkdir -p $out/bin
cp -r opt/enpass/* $out/bin
cp -r usr/* $out
2016-09-19 16:50:52 +00:00
sed \
2019-01-11 21:32:00 +00:00
-i s@/opt/enpass/Enpass@$out/bin/Enpass@ \
$out/share/applications/enpass.desktop
2016-09-19 16:50:52 +00:00
2019-01-11 21:32:00 +00:00
for i in $out/bin/{Enpass,importer_enpass}; do
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i
done
2016-09-19 16:50:52 +00:00
2019-01-11 21:32:00 +00:00
# lsof must be in PATH for proper operation
2016-09-19 16:50:52 +00:00
wrapProgram $out/bin/Enpass \
2019-01-11 21:32:00 +00:00
--set LD_LIBRARY_PATH "${libPath}" \
--prefix PATH : ${lsof}/bin
2016-09-19 16:50:52 +00:00
'';
};
updater = {
update = stdenv.mkDerivation rec {
name = "enpass-update-script";
SCRIPT =./update_script.py;
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}
'';
};
};
in (package // {refresh = updater;})