git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #144524 from prusnak/bitwarden

bitwarden: 1.28.1 -> 1.29.1

commite955fad09e7c6f0cc08e238307b00e527368d975 authorPavol Rusnak <pavol@rusnak.io> dateThu 4 Nov 2021, 10:47 (5 years ago) parentf0e0efa942fe94
1 file changed+45−61
pkgs/tools/security/bitwarden/default.nix+45−61
pkgs/tools/security/bitwarden/default.nix+45−61
@@ -4,6 +4,7 @@
44, fetchurl
55, lib
66, libsecret
7+, libxshmfence
78, makeDesktopItem
89, makeWrapper
910, stdenv
@@ -11,78 +12,61 @@
1112, wrapGAppsHook
1213}:
1314
14−let
15− inherit (stdenv.hostPlatform) system;
16−
15+stdenv.mkDerivation rec {
1716 pname = "bitwarden";
17+ version = "1.29.1";
1818
19− version = {
20− x86_64-linux = "1.28.1";
21− }.${system} or "";
22−
23− sha256 = {
24− x86_64-linux = "sha256-vyEbISZDTN+CHqSEtElzfg4M4i+2RjUux5vzwJw8/dc=";
25− }.${system} or "";
26−
27− meta = with lib; {
28− description = "A secure and free password manager for all of your devices";
29− homepage = "https://bitwarden.com";
30− license = licenses.gpl3;
31− maintainers = with maintainers; [ kiwi ];
32− platforms = [ "x86_64-linux" ];
19+ src = fetchurl {
20+ url = "https://github.com/bitwarden/desktop/releases/download/v${version}/Bitwarden-${version}-amd64.deb";
21+ sha256 = "0rxy19bazi7a6m2bpx6wadg5d9p0k324h369vgr5ppmxb69d6zp8";
3322 };
3423
35− linux = stdenv.mkDerivation rec {
36− inherit pname version meta;
37−
38− src = fetchurl {
39− url = "https://github.com/bitwarden/desktop/releases/download/"
40− + "v${version}/Bitwarden-${version}-amd64.deb";
41− inherit sha256;
42− };
24+ desktopItem = makeDesktopItem {
25+ name = "bitwarden";
26+ exec = "bitwarden %U";
27+ icon = "bitwarden";
28+ comment = "A secure and free password manager for all of your devices";
29+ desktopName = "Bitwarden";
30+ categories = "Utility";
31+ };
4332
44− desktopItem = makeDesktopItem {
45− name = "bitwarden";
46− exec = "bitwarden %U";
47− icon = "bitwarden";
48− comment = "A secure and free password manager for all of your devices";
49− desktopName = "Bitwarden";
50− categories = "Utility";
51− };
33+ dontBuild = true;
34+ dontConfigure = true;
35+ dontPatchELF = true;
36+ dontWrapGApps = true;
5237
53− dontBuild = true;
54− dontConfigure = true;
55− dontPatchELF = true;
56− dontWrapGApps = true;
38+ nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
5739
58− buildInputs = [ libsecret ] ++ atomEnv.packages;
40+ buildInputs = [ libsecret libxshmfence ] ++ atomEnv.packages;
5941
60− nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
42+ unpackPhase = "dpkg-deb -x $src .";
6143
62− unpackPhase = "dpkg-deb -x $src .";
44+ installPhase = ''
45+ mkdir -p "$out/bin"
46+ cp -R "opt" "$out"
47+ cp -R "usr/share" "$out/share"
48+ chmod -R g-w "$out"
6349
64− installPhase = ''
65− mkdir -p "$out/bin"
66− cp -R "opt" "$out"
67− cp -R "usr/share" "$out/share"
68− chmod -R g-w "$out"
50+ # Desktop file
51+ mkdir -p "$out/share/applications"
52+ cp "${desktopItem}/share/applications/"* "$out/share/applications"
53+ '';
6954
70− # Desktop file
71− mkdir -p "$out/share/applications"
72− cp "${desktopItem}/share/applications/"* "$out/share/applications"
73− '';
55+ runtimeDependencies = [
56+ (lib.getLib udev)
57+ ];
7458
75− runtimeDependencies = [
76− (lib.getLib udev)
77− ];
59+ postFixup = ''
60+ makeWrapper $out/opt/Bitwarden/bitwarden $out/bin/bitwarden \
61+ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsecret stdenv.cc.cc ] }" \
62+ "''${gappsWrapperArgs[@]}"
63+ '';
7864
79− postFixup = ''
80− makeWrapper $out/opt/Bitwarden/bitwarden $out/bin/bitwarden \
81− --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsecret stdenv.cc.cc ] }" \
82− "''${gappsWrapperArgs[@]}"
83− '';
65+ meta = with lib; {
66+ description = "A secure and free password manager for all of your devices";
67+ homepage = "https://bitwarden.com";
68+ license = licenses.gpl3;
69+ maintainers = with maintainers; [ kiwi ];
70+ platforms = [ "x86_64-linux" ];
8471 };
85−
86−in if stdenv.isDarwin
87−then throw "Bitwarden has not been packaged for macOS yet"
88−else linux
72+}