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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
2.4 KiB
Nix
Raw Normal View History

2019-01-11 22:32:00 +01:00
{ stdenv, fetchurl, dpkg, xorg
2019-11-10 17:44:34 +01:00
, glib, libGLU, libGL, libpulseaudio, zlib, dbus, fontconfig, freetype
2019-01-11 22:32:00 +01:00
, gtk3, pango
2022-01-02 03:12:34 +01:00
, makeWrapper , python3Packages, lib
2021-03-14 19:12:53 +01:00
, lsof, curl, libuuid, cups, mesa, xz, libxkbcommon
}:
2016-09-19 18:50:52 +02:00
let
all_data = lib.importJSON ./data.json;
2016-09-19 18:50:52 +02:00
system_map = {
2019-01-11 22:32:00 +01:00
# i686-linux = "i386"; Uncomment if enpass 6 becomes available on i386
2016-09-19 18:50:52 +02:00
x86_64-linux = "amd64";
};
data = all_data.${system_map.${stdenv.hostPlatform.system} or (throw "Unsupported platform")};
2016-09-19 18:50:52 +02:00
baseUrl = "http://repo.sinew.in";
2016-09-19 18:50:52 +02:00
# used of both wrappers and libpath
libPath = lib.makeLibraryPath (with xorg; [
mesa.drivers
2019-11-10 17:44:34 +01:00
libGLU libGL
2016-09-19 18:50:52 +02:00
fontconfig
freetype
libpulseaudio
zlib
dbus
libX11
libXi
libSM
libICE
libXrender
libXScrnSaver
2019-01-11 22:32:00 +01:00
libxcb
2016-09-19 18:50:52 +02:00
glib
2019-01-11 22:32:00 +01:00
gtk3
2016-09-19 18:50:52 +02:00
pango
2019-01-11 22:32:00 +01:00
curl
libuuid
cups
2021-03-14 19:12:53 +01:00
xz
2020-12-11 23:29:48 +01:00
libxkbcommon
2016-09-19 18:50:52 +02:00
]);
2019-08-13 23:52:01 +02:00
package = stdenv.mkDerivation {
2016-09-19 18:50:52 +02:00
inherit (data) version;
pname = "enpass";
2016-09-19 18:50:52 +02:00
src = fetchurl {
inherit (data) sha256;
url = "${baseUrl}/${data.path}";
};
meta = with lib; {
2020-12-11 23:29:48 +01:00
description = "A well known password manager";
homepage = "https://www.enpass.io/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
2020-12-11 23:29:48 +01:00
license = licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux"];
2020-12-21 09:18:40 +01:00
maintainers = with maintainers; [ ewok ];
2016-09-19 18:50:52 +02:00
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [dpkg];
2016-09-19 18:50:52 +02:00
unpackPhase = "dpkg -X $src .";
installPhase=''
2019-01-11 22:32:00 +01:00
mkdir -p $out/bin
cp -r opt/enpass/* $out/bin
cp -r usr/* $out
2016-09-19 18:50:52 +02:00
sed \
2019-01-11 22:32:00 +01:00
-i s@/opt/enpass/Enpass@$out/bin/Enpass@ \
$out/share/applications/enpass.desktop
2016-09-19 18:50:52 +02:00
2019-01-11 22:32:00 +01: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 18:50:52 +02:00
2019-01-11 22:32:00 +01:00
# lsof must be in PATH for proper operation
2016-09-19 18:50:52 +02:00
wrapProgram $out/bin/Enpass \
2019-01-11 22:32:00 +01:00
--set LD_LIBRARY_PATH "${libPath}" \
2021-01-07 21:03:28 +01:00
--prefix PATH : ${lsof}/bin \
--unset QML2_IMPORT_PATH \
--unset QT_PLUGIN_PATH
2016-09-19 18:50:52 +02:00
'';
};
updater = {
2019-08-13 23:52:01 +02:00
update = stdenv.mkDerivation {
2016-09-19 18:50:52 +02:00
name = "enpass-update-script";
SCRIPT =./update_script.py;
2022-01-02 03:12:34 +01:00
buildInputs = with python3Packages; [python requests pathlib2 six attrs ];
2016-09-19 18:50:52 +02:00
shellHook = ''
2019-11-13 16:18:05 +01:00
exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl}
2016-09-19 18:50:52 +02:00
'';
};
};
in (package // {refresh = updater;})