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
|
2023-08-04 22:07:22 +00:00
|
|
|
, darwin
|
2024-01-13 08:15:51 +00:00
|
|
|
, bash
|
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";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.12.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";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-+1kalFyhk2UL+iVzuFLDsSSTudrd4QpXw+3O4J+KsLc=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
cargoHash = "sha256-cKbbsDb449WANGT+x8APhzs+hf5SR3RBsCBWDNceRMA=";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-05-03 20:48:10 +00:00
|
|
|
installShellFiles
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
buildInputs = [ bash ] # for git-credential-rbw
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-01-13 08:15:51 +00:00
|
|
|
darwin.apple_sdk_11_0.frameworks.Security
|
|
|
|
darwin.apple_sdk_11_0.frameworks.AppKit
|
2023-08-04 22:07:22 +00:00
|
|
|
];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
preConfigure = lib.optionalString stdenv.hostPlatform.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
|
2024-09-19 14:19:46 +00:00
|
|
|
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2023-02-22 10:55:15 +00:00
|
|
|
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;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ albakham luc65r ];
|
|
|
|
mainProgram = "rbw";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
}
|