nixos-config/packages/rbw-latest.nix

85 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2025-01-01 14:48:06 -05:00
{
lib,
stdenv,
rustPlatform,
fetchzip,
openssl,
pkg-config,
installShellFiles,
bash,
# rbw-fzf
2025-01-06 15:25:02 -05:00
withFzf ? false,
2025-01-01 14:48:06 -05:00
fzf,
2025-01-06 15:25:02 -05:00
perl,
# rbw-rofi
withRofi ? false,
rofi,
xclip,
# pass-import
withPass ? false,
pass,
2025-01-01 14:48:06 -05:00
}:
rustPlatform.buildRustPackage rec {
pname = "rbw-latest";
2025-02-07 18:15:39 -05:00
version = "1.13.2";
2025-01-01 14:48:06 -05:00
src = fetchzip {
url = "https://git.tozt.net/rbw/snapshot/rbw-${version}.tar.gz";
2025-02-09 00:31:36 -05:00
hash = "sha256-ebLbdIF+BybK7ssNtZacGWmAEwdNZh8b94QYgvcwzmM=";
2025-01-01 14:48:06 -05:00
};
2025-04-06 16:18:55 -04:00
cargoHash = "sha256-xDb4shDHCbd0yuTSAt80i1aqyuhpkfd/fYF98CfXdcM=";
2025-01-01 14:48:06 -05:00
nativeBuildInputs = [
installShellFiles
] ++ lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ];
2025-01-06 15:25:02 -05:00
buildInputs = [ bash ]; # for git-credential-rbw
2025-01-01 14:48:06 -05:00
preConfigure = lib.optionalString stdenv.hostPlatform.isLinux ''
export OPENSSL_INCLUDE_DIR="${openssl.dev}/include"
export OPENSSL_LIB_DIR="${lib.getLib openssl}/lib"
'';
postInstall =
''
install -Dm755 -t $out/bin bin/git-credential-rbw
2025-01-06 15:25:02 -05:00
install -Dm755 -t $out/bin bin/rbw-pinentry-keyring
2025-01-01 14:48:06 -05:00
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd rbw \
--bash <($out/bin/rbw gen-completions bash) \
--fish <($out/bin/rbw gen-completions fish) \
--zsh <($out/bin/rbw gen-completions zsh)
2025-01-06 15:25:02 -05:00
''
+ lib.optionalString withFzf ''
install -Dm755 -t $out/bin bin/rbw-fzf
substituteInPlace $out/bin/rbw-fzf \
--replace fzf ${fzf}/bin/fzf \
--replace perl ${perl}/bin/perl
''
+ lib.optionalString withRofi ''
install -Dm755 -t $out/bin bin/rbw-rofi
substituteInPlace $out/bin/rbw-rofi \
--replace rofi ${rofi}/bin/rofi \
--replace xclip ${xclip}/bin/xclip
''
+ lib.optionalString withPass ''
install -Dm755 -t $out/bin bin/pass-import
substituteInPlace $out/bin/pass-import \
--replace pass ${pass}/bin/pass
2025-01-01 14:48:06 -05:00
'';
meta = with lib; {
description = "Unofficial command line client for Bitwarden";
homepage = "https://crates.io/crates/rbw";
changelog = "https://git.tozt.net/rbw/plain/CHANGELOG.md?id=${version}";
license = licenses.mit;
2025-01-06 15:25:02 -05:00
maintainers = with maintainers; [ albakham ];
2025-01-01 14:48:06 -05:00
mainProgram = "rbw";
};
}