nixpkgs/pkgs/applications/misc/keeweb/default.nix

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

118 lines
2.6 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
, undmg
, dpkg
, autoPatchelfHook
, wrapGAppsHook
, makeWrapper
, alsa-lib
, at-spi2-atk
, gdk-pixbuf
, glibc
, nss
, udev
, xorg
, gnome
, mesa
, gtk3
, libusb1
, libsecret
, libappindicator
, xdotool
}:
2020-05-25 18:44:29 +03:00
let
pname = "keeweb";
2022-09-13 19:15:30 +03:00
version = "1.18.7";
2020-05-25 18:44:29 +03:00
2021-05-16 15:05:57 +03:00
srcs = {
x86_64-linux = fetchurl {
url = "https://github.com/keeweb/keeweb/releases/download/v${version}/KeeWeb-${version}.linux.x64.deb";
hash = "sha256-/U+vn5TLIU9/J6cRFjuAdyGzlwC04mp4L2X2ETp+ZSE=";
2021-05-16 15:05:57 +03:00
};
x86_64-darwin = fetchurl {
url = "https://github.com/keeweb/keeweb/releases/download/v${version}/KeeWeb-${version}.mac.x64.dmg";
2022-09-13 19:15:30 +03:00
hash = "sha256-+ZFGrrw0tZ7F6lb/3iBIyGD+tp1puVhkPv10hfp6ATU=";
2021-05-16 15:05:57 +03:00
};
aarch64-darwin = fetchurl {
url = "https://github.com/keeweb/keeweb/releases/download/v${version}/KeeWeb-${version}.mac.arm64.dmg";
2022-09-13 19:15:30 +03:00
hash = "sha256-bkhwsWYLkec16vMOfXUce7jfrmI9W2xHiZvU1asebK4=";
2021-05-16 15:05:57 +03:00
};
2020-05-25 18:44:29 +03:00
};
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
2020-05-25 18:44:29 +03:00
libraries = [
alsa-lib
at-spi2-atk
gdk-pixbuf
nss
udev
xorg.libX11
xorg.libXcomposite
xorg.libXext
xorg.libXrandr
xorg.libXScrnSaver
xorg.libXtst
xorg.libxshmfence
gnome.gnome-keyring
mesa
gtk3
libusb1
libsecret
libappindicator
xdotool
];
2020-05-25 18:44:29 +03:00
meta = with lib; {
2020-05-25 18:44:29 +03:00
description = "Free cross-platform password manager compatible with KeePass";
homepage = "https://keeweb.info/";
2021-03-09 22:33:10 +03:00
changelog = "https://github.com/keeweb/keeweb/blob/v${version}/release-notes.md";
2022-09-13 19:15:30 +03:00
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
2020-05-25 18:44:29 +03:00
license = licenses.mit;
maintainers = with maintainers; [ sikmir ];
2021-05-16 15:05:57 +03:00
platforms = builtins.attrNames srcs;
2020-05-25 18:44:29 +03:00
};
in
if stdenv.isDarwin
then stdenv.mkDerivation {
inherit pname version src meta;
2020-05-25 18:44:29 +03:00
nativeBuildInputs = [ undmg ];
2020-05-25 18:44:29 +03:00
sourceRoot = ".";
2020-05-25 18:44:29 +03:00
installPhase = ''
mkdir -p $out/Applications
cp -r *.app $out/Applications
'';
}
else stdenv.mkDerivation {
inherit pname version src meta;
2020-05-25 18:44:29 +03:00
nativeBuildInputs = [
autoPatchelfHook
wrapGAppsHook
makeWrapper
];
2020-05-25 18:44:29 +03:00
buildInputs = libraries;
2020-05-25 18:44:29 +03:00
unpackPhase = ''
${dpkg}/bin/dpkg-deb --fsys-tarfile $src | tar --extract
'';
2020-05-25 18:44:29 +03:00
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r usr/share $out/share
makeWrapper $out/share/keeweb-desktop/keeweb $out/bin/keeweb \
--argv0 "keeweb" \
--add-flags "$out/share/keeweb-desktop/resources/app.asar" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libraries}"
runHook postInstall
'';
}