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";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.29.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/bitwarden/desktop/releases/download/v${version}/Bitwarden-${version}-amd64.deb";
|
|
|
|
sha256 = "0rxy19bazi7a6m2bpx6wadg5d9p0k324h369vgr5ppmxb69d6zp8";
|
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";
|
|
|
|
categories = "Utility";
|
|
|
|
};
|
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";
|
|
|
|
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
|
|
|
}
|