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
|
2023-03-15 16:39:30 +00:00
|
|
|
, fetchzip
|
2020-09-25 04:45:31 +00:00
|
|
|
, openssl
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2021-05-03 20:48:10 +00:00
|
|
|
, installShellFiles
|
2020-10-07 09:15:18 +00:00
|
|
|
, Security
|
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";
|
2023-03-30 22:05:00 +00:00
|
|
|
version = "1.7.1";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://git.tozt.net/rbw/snapshot/rbw-${version}.tar.gz";
|
2023-03-30 22:05:00 +00:00
|
|
|
sha256 = "sha256-xE3T3iVXFaaTF90ehQiG6+dLXcsqrHeprSMUnlSsxkE=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
cargoHash = "sha256-eaG56FGz4smlqDPi/CJ0KB7NMEgp684X19PVWxGQutw=";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-05-03 20:48:10 +00:00
|
|
|
installShellFiles
|
2023-02-22 10:55:15 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [ pkg-config ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
preConfigure = lib.optionalString stdenv.isLinux ''
|
2020-09-25 04:45:31 +00:00
|
|
|
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 = ''
|
2023-02-22 10:55:15 +00:00
|
|
|
install -Dm755 -t $out/bin bin/git-credential-rbw
|
|
|
|
installShellCompletion --cmd rbw \
|
|
|
|
--bash <($out/bin/rbw gen-completions bash) \
|
|
|
|
--fish <($out/bin/rbw gen-completions fish) \
|
|
|
|
--zsh <($out/bin/rbw gen-completions zsh)
|
2021-05-03 20:48:10 +00:00
|
|
|
'' + lib.optionalString withFzf ''
|
2023-02-22 10:55:15 +00:00
|
|
|
install -Dm755 -t $out/bin bin/rbw-fzf
|
|
|
|
substituteInPlace $out/bin/rbw-fzf \
|
|
|
|
--replace fzf ${fzf}/bin/fzf \
|
|
|
|
--replace perl ${perl}/bin/perl
|
2020-09-25 04:45:31 +00:00
|
|
|
'' + lib.optionalString withRofi ''
|
2023-02-22 10:55:15 +00:00
|
|
|
install -Dm755 -t $out/bin bin/rbw-rofi
|
|
|
|
substituteInPlace $out/bin/rbw-rofi \
|
|
|
|
--replace rofi ${rofi}/bin/rofi \
|
|
|
|
--replace xclip ${xclip}/bin/xclip
|
2020-09-25 04:45:31 +00:00
|
|
|
'' + lib.optionalString withPass ''
|
2023-02-22 10:55:15 +00:00
|
|
|
install -Dm755 -t $out/bin bin/pass-import
|
|
|
|
substituteInPlace $out/bin/pass-import \
|
|
|
|
--replace pass ${pass}/bin/pass
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|