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

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

73 lines
1.7 KiB
Nix
Raw Normal View History

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