2020-09-25 04:45:31 +00:00
|
|
|
{ lib
|
2020-10-07 09:15:18 +00:00
|
|
|
, stdenv
|
2020-09-25 04:45:31 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchCrate
|
|
|
|
, openssl
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-09-25 04:45:31 +00:00
|
|
|
, makeWrapper
|
2021-05-03 20:48:10 +00:00
|
|
|
, installShellFiles
|
2020-10-07 09:15:18 +00:00
|
|
|
, Security
|
2021-03-12 07:09:13 +00:00
|
|
|
, libiconv
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# rbw-fzf
|
|
|
|
, withFzf ? false
|
|
|
|
, fzf
|
|
|
|
, perl
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# rbw-rofi
|
|
|
|
, withRofi ? false
|
|
|
|
, rofi
|
|
|
|
, xclip
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# pass-import
|
|
|
|
, withPass ? false
|
|
|
|
, pass
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rbw";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "1.4.3";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchCrate {
|
|
|
|
inherit version;
|
2020-11-03 02:18:15 +00:00
|
|
|
crateName = pname;
|
2022-02-20 05:27:41 +00:00
|
|
|
sha256 = "sha256-teeGKQNf+nuUcF9BcdiTV/ycENTbcGvPZZ34FdOO31k=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
cargoSha256 = "sha256-Soquc3OuGlDsGSwNCvYOWQeraYpkzX1oJwmM03Rc3Jg=";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-09-25 04:45:31 +00:00
|
|
|
makeWrapper
|
2021-05-03 20:48:10 +00:00
|
|
|
installShellFiles
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
|
|
|
|
2021-03-12 07:09:13 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ Security libiconv ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs bin/git-credential-rbw
|
|
|
|
substituteInPlace bin/git-credential-rbw \
|
|
|
|
--replace rbw $out/bin/rbw
|
|
|
|
'' + lib.optionalString withFzf ''
|
2020-09-25 04:45:31 +00:00
|
|
|
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"
|
2022-04-03 18:54:34 +00:00
|
|
|
export OPENSSL_LIB_DIR="${lib.getLib openssl}/lib"
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
postInstall = ''
|
|
|
|
for shell in bash zsh fish; do
|
|
|
|
$out/bin/rbw gen-completions $shell > rbw.$shell
|
|
|
|
installShellCompletion rbw.$shell
|
|
|
|
done
|
2021-12-06 16:07:01 +00:00
|
|
|
cp bin/git-credential-rbw $out/bin
|
2021-05-03 20:48:10 +00:00
|
|
|
'' + lib.optionalString withFzf ''
|
2020-09-25 04:45:31 +00:00
|
|
|
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";
|
2020-12-25 13:55:36 +00:00
|
|
|
changelog = "https://git.tozt.net/rbw/plain/CHANGELOG.md?id=${version}";
|
2020-09-25 04:45:31 +00:00
|
|
|
license = licenses.mit;
|
2020-10-19 00:13:06 +00:00
|
|
|
maintainers = with maintainers; [ albakham luc65r marsam ];
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
}
|