2020-04-24 23:36:52 +00:00
|
|
|
{ atomEnv
|
|
|
|
, autoPatchelfHook
|
|
|
|
, dpkg
|
|
|
|
, fetchurl
|
2021-06-01 10:57:12 +00:00
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, libsecret
|
2021-12-06 16:07:01 +00:00
|
|
|
, libxshmfence
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
|
|
|
, stdenv
|
|
|
|
, udev
|
|
|
|
, wrapGAppsHook
|
|
|
|
}:
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "bitwarden";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "2022.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchurl {
|
2022-06-26 10:26:21 +00:00
|
|
|
url = "https://github.com/bitwarden/clients/releases/download/desktop-v${version}/Bitwarden-${version}-amd64.deb";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-MmhHs1Gp6H1CkLO/yCBhsF0KMiYXz37D6QP26fS+/u0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "bitwarden";
|
|
|
|
exec = "bitwarden %U";
|
|
|
|
icon = "bitwarden";
|
|
|
|
comment = "A secure and free password manager for all of your devices";
|
|
|
|
desktopName = "Bitwarden";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Utility" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
dontBuild = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontWrapGApps = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [ libsecret libxshmfence ] ++ atomEnv.packages;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
unpackPhase = "dpkg-deb -x $src .";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp -R "opt" "$out"
|
|
|
|
cp -R "usr/share" "$out/share"
|
|
|
|
chmod -R g-w "$out"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Desktop file
|
|
|
|
mkdir -p "$out/share/applications"
|
|
|
|
cp "${desktopItem}/share/applications/"* "$out/share/applications"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
runtimeDependencies = [
|
|
|
|
(lib.getLib udev)
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postFixup = ''
|
|
|
|
makeWrapper $out/opt/Bitwarden/bitwarden $out/bin/bitwarden \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsecret stdenv.cc.cc ] }" \
|
|
|
|
"''${gappsWrapperArgs[@]}"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A secure and free password manager for all of your devices";
|
|
|
|
homepage = "https://bitwarden.com";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ kiwi ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
}
|