aboutsummaryrefslogtreecommitdiff
path: root/pkgs/tools/security/rbw
diff options
context:
space:
mode:
authorluc65r <lucas@ransan.tk>2020-05-19 18:10:52 +0200
committerluc65r <lucas@ransan.tk>2020-07-08 15:10:54 +0200
commit3483bf8b7b484266aee274baea8d1f2458de37dd (patch)
tree75812bc365d5b8506d364eb7c2ce2d872fafad65 /pkgs/tools/security/rbw
parentd56c5bdc415efd686147717634f3348c75ed4d95 (diff)
rbw: init at 0.4.4
Diffstat (limited to 'pkgs/tools/security/rbw')
-rw-r--r--pkgs/tools/security/rbw/default.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/tools/security/rbw/default.nix b/pkgs/tools/security/rbw/default.nix
new file mode 100644
index 000000000000..11045e53f23b
--- /dev/null
+++ b/pkgs/tools/security/rbw/default.nix
@@ -0,0 +1,76 @@
+{ lib
+, rustPlatform
+, fetchCrate
+, pinentry
+, openssl
+, pkgconfig
+, makeWrapper
+, cargo
+
+# rbw-fzf
+, withFzf ? false, fzf, perl
+
+# rbw-rofi
+, withRofi ? false, rofi, xclip
+
+# pass-import
+, withPass ? false, pass
+}:
+
+rustPlatform.buildRustPackage rec {
+ pname = "rbw";
+ version = "0.4.4";
+
+ src = fetchCrate {
+ inherit version;
+ crateName = "${pname}";
+ sha256 = "01p37zx2h3gpm363xn96w0wlg7kqayjl3an65h9p6md21d41bvyr";
+ };
+
+ cargoSha256 = "1xiw21snsbqxfw624cdc340asp2kmcp8rymfcjj7w2lwcqhadrh9";
+
+ nativeBuildInputs = [
+ pkgconfig
+ makeWrapper
+ ];
+
+ postPatch = ''
+ substituteInPlace src/pinentry.rs \
+ --replace "Command::new(\"pinentry\")" "Command::new(\"${pinentry}/bin/pinentry\")"
+ '' + lib.optionalString withFzf ''
+ patchShebangs bin/rbw-fzf
+ substituteInPlace bin/rbw-fzf \
+ --replace fzf ${fzf}/bin/fzf \
+ --replace perl ${perl}/bin/perl
+ '' + lib.optionalString withRofi ''
+ patchShebangs bin/rbw-rofi
+ substituteInPlace bin/rbw-rofi \
+ --replace rofi ${rofi}/bin/rofi \
+ --replace xclip ${xclip}/bin/xclip
+ '' + lib.optionalString withRofi ''
+ patchShebangs bin/pass-import
+ substituteInPlace bin/pass-import \
+ --replace pass ${pass}/bin/pass
+ '';
+
+ preConfigure = ''
+ export OPENSSL_INCLUDE_DIR="${openssl.dev}/include"
+ export OPENSSL_LIB_DIR="${openssl.out}/lib"
+ '';
+
+ postInstall = lib.optionalString withFzf ''
+ cp bin/rbw-fzf $out/bin
+ '' + lib.optionalString withRofi ''
+ cp bin/rbw-rofi $out/bin
+ '' + lib.optionalString withPass ''
+ cp bin/pass-import $out/bin
+ '';
+
+ meta = with lib; {
+ description = "Unofficial command line client for Bitwarden";
+ homepage = "https://crates.io/crates/rbw";
+ license = licenses.mit;
+ maintainers = with maintainers; [ albakham luc65r ];
+ platforms = platforms.all;
+ };
+}