nixpkgs/pkgs/tools/security/enpass/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

98 lines
2.3 KiB
Nix

{ stdenv, fetchurl, dpkg, xorg
, glib, libGLU, libGL, libpulseaudio, zlib, dbus, fontconfig, freetype
, gtk3, pango
, makeWrapper , python2Packages, lib
, lsof, curl, libuuid, cups, mesa, lzma, libxkbcommon
}:
let
all_data = builtins.fromJSON (builtins.readFile ./data.json);
system_map = {
# i686-linux = "i386"; Uncomment if enpass 6 becomes available on i386
x86_64-linux = "amd64";
};
data = all_data.${system_map.${stdenv.hostPlatform.system} or (throw "Unsupported platform")};
baseUrl = "http://repo.sinew.in";
# used of both wrappers and libpath
libPath = lib.makeLibraryPath (with xorg; [
mesa.drivers
libGLU libGL
fontconfig
freetype
libpulseaudio
zlib
dbus
libX11
libXi
libSM
libICE
libXrender
libXScrnSaver
libxcb
glib
gtk3
pango
curl
libuuid
cups
lzma
libxkbcommon
]);
package = stdenv.mkDerivation {
inherit (data) version;
pname = "enpass";
src = fetchurl {
inherit (data) sha256;
url = "${baseUrl}/${data.path}";
};
meta = with lib; {
description = "A well known password manager";
homepage = "https://www.enpass.io/";
license = licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux"];
maintainers = with maintainers; [ ewok ];
};
buildInputs = [makeWrapper dpkg];
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = "dpkg -X $src .";
installPhase=''
mkdir -p $out/bin
cp -r opt/enpass/* $out/bin
cp -r usr/* $out
sed \
-i s@/opt/enpass/Enpass@$out/bin/Enpass@ \
$out/share/applications/enpass.desktop
for i in $out/bin/{Enpass,importer_enpass}; do
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $i
done
# lsof must be in PATH for proper operation
wrapProgram $out/bin/Enpass \
--set LD_LIBRARY_PATH "${libPath}" \
--prefix PATH : ${lsof}/bin
'';
};
updater = {
update = stdenv.mkDerivation {
name = "enpass-update-script";
SCRIPT =./update_script.py;
buildInputs = with python2Packages; [python requests pathlib2 six attrs ];
shellHook = ''
exec python $SCRIPT --target pkgs/tools/security/enpass/data.json --repo ${baseUrl}
'';
};
};
in (package // {refresh = updater;})