From 3483bf8b7b484266aee274baea8d1f2458de37dd Mon Sep 17 00:00:00 2001 From: luc65r Date: Tue, 19 May 2020 18:10:52 +0200 Subject: [PATCH] rbw: init at 0.4.4 --- pkgs/tools/security/rbw/default.nix | 76 +++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 78 insertions(+) create mode 100644 pkgs/tools/security/rbw/default.nix 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 109c39e804f1..9bda9984a345 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6220,6 +6220,8 @@ in pywal = with python3Packages; toPythonApplication pywal; + rbw = callPackage ../tools/security/rbw { }; + remarshal = callPackage ../development/tools/remarshal { }; rig = callPackage ../tools/misc/rig {