nixpkgs/pkgs/tools/security/bitwarden/default.nix

73 lines
1.7 KiB
Nix
Raw Normal View History

2019-08-02 06:48:20 +02:00
{ atomEnv
, autoPatchelfHook
, dpkg
, fetchurl
2021-05-27 21:14:18 +02:00
, lib
2019-08-02 06:48:20 +02:00
, libsecret
2021-11-03 20:37:50 +01:00
, libxshmfence
2019-08-02 06:48:20 +02:00
, makeDesktopItem
, makeWrapper
, stdenv
, udev
, wrapGAppsHook
}:
2021-11-03 20:37:50 +01:00
stdenv.mkDerivation rec {
2019-08-02 06:48:20 +02:00
pname = "bitwarden";
2021-12-15 19:34:38 +01:00
version = "1.30.0";
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
src = fetchurl {
url = "https://github.com/bitwarden/desktop/releases/download/v${version}/Bitwarden-${version}-amd64.deb";
2021-12-15 19:34:38 +01:00
sha256 = "sha256-x0i7MUVr0nhPy8M/dTVtRjaLfJQlzqhzLQ/JHLRmL6E=";
2019-08-02 06:48:20 +02:00
};
2021-11-03 20:37:50 +01: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";
};
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
dontBuild = true;
dontConfigure = true;
dontPatchELF = true;
dontWrapGApps = true;
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
buildInputs = [ libsecret libxshmfence ] ++ atomEnv.packages;
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
unpackPhase = "dpkg-deb -x $src .";
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
installPhase = ''
mkdir -p "$out/bin"
cp -R "opt" "$out"
cp -R "usr/share" "$out/share"
chmod -R g-w "$out"
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
# Desktop file
mkdir -p "$out/share/applications"
cp "${desktopItem}/share/applications/"* "$out/share/applications"
'';
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
runtimeDependencies = [
(lib.getLib udev)
];
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01:00
postFixup = ''
makeWrapper $out/opt/Bitwarden/bitwarden $out/bin/bitwarden \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsecret stdenv.cc.cc ] }" \
"''${gappsWrapperArgs[@]}"
'';
2019-08-02 06:48:20 +02:00
2021-11-03 20:37:50 +01: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" ];
2019-08-02 06:48:20 +02:00
};
2021-11-03 20:37:50 +01:00
}