nixpkgs/pkgs/tools/security/rbw/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.0 KiB
Nix
Raw Normal View History

2020-05-19 16:10:52 +00:00
{ lib
2020-10-01 04:20:00 +00:00
, stdenv
2020-05-19 16:10:52 +00:00
, rustPlatform
2023-03-10 04:20:00 +00:00
, fetchzip
2020-05-19 16:10:52 +00:00
, openssl
2021-01-17 03:51:22 +00:00
, pkg-config
2021-04-25 04:20:00 +00:00
, installShellFiles
2020-10-01 04:20:00 +00:00
, Security
2020-05-19 16:10:52 +00:00
2021-10-28 07:13:13 +00:00
# rbw-fzf
, withFzf ? false
, fzf
, perl
# rbw-rofi
, withRofi ? false
, rofi
, xclip
# pass-import
, withPass ? false
, pass
2020-05-19 16:10:52 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "rbw";
2023-03-28 04:20:00 +00:00
version = "1.7.1";
2020-05-19 16:10:52 +00:00
2023-03-10 04:20:00 +00:00
src = fetchzip {
url = "https://git.tozt.net/rbw/snapshot/rbw-${version}.tar.gz";
2023-03-28 04:20:00 +00:00
sha256 = "sha256-xE3T3iVXFaaTF90ehQiG6+dLXcsqrHeprSMUnlSsxkE=";
2020-05-19 16:10:52 +00:00
};
2023-03-28 04:20:00 +00:00
cargoHash = "sha256-eaG56FGz4smlqDPi/CJ0KB7NMEgp684X19PVWxGQutw=";
2020-05-19 16:10:52 +00:00
nativeBuildInputs = [
2021-04-25 04:20:00 +00:00
installShellFiles
2023-02-18 04:20:00 +00:00
] ++ lib.optionals stdenv.isLinux [ pkg-config ];
2020-05-19 16:10:52 +00:00
2023-02-18 04:20:00 +00:00
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
2020-10-01 04:20:00 +00:00
2023-02-18 04:20:00 +00:00
preConfigure = lib.optionalString stdenv.isLinux ''
2020-05-19 16:10:52 +00:00
export OPENSSL_INCLUDE_DIR="${openssl.dev}/include"
treewide: use lib.getLib for OpenSSL libraries At some point, I'd like to make another attempt at 71f1f4884b5 ("openssl: stop static binaries referencing libs"), which was reverted in 195c7da07df. One problem with my previous attempt is that I moved OpenSSL's libraries to a lib output, but many dependent packages were hardcoding the out output as the location of the libraries. This patch fixes every such case I could find in the tree. It won't have any effect immediately, but will mean these packages will automatically use an OpenSSL lib output if it is reintroduced in future. This patch should cause very few rebuilds, because it shouldn't make any change at all to most packages I'm touching. The few rebuilds that are introduced come from when I've changed a package builder not to use variable names like openssl.out in scripts / substitution patterns, which would be confusing since they don't hardcode the output any more. I started by making the following global replacements: ${pkgs.openssl.out}/lib -> ${lib.getLib pkgs.openssl}/lib ${openssl.out}/lib -> ${lib.getLib openssl}/lib Then I removed the ".out" suffix when part of the argument to lib.makeLibraryPath, since that function uses lib.getLib internally. Then I fixed up cases where openssl was part of the -L flag to the compiler/linker, since that unambigously is referring to libraries. Then I manually investigated and fixed the following packages: - pycurl - citrix-workspace - ppp - wraith - unbound - gambit - acl2 I'm reasonably confindent in my fixes for all of them. For acl2, since the openssl library paths are manually provided above anyway, I don't think openssl is required separately as a build input at all. Removing it doesn't make a difference to the output size, the file list, or the closure. I've tested evaluation with the OfBorg meta checks, to protect against introducing evaluation failures.
2022-03-25 15:33:21 +00:00
export OPENSSL_LIB_DIR="${lib.getLib openssl}/lib"
2020-05-19 16:10:52 +00:00
'';
2021-04-25 04:20:00 +00:00
postInstall = ''
2023-02-18 04:20:00 +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-04-25 04:20:00 +00:00
'' + lib.optionalString withFzf ''
2023-02-18 04:20:00 +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-05-19 16:10:52 +00:00
'' + lib.optionalString withRofi ''
2023-02-18 04:20:00 +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-05-19 16:10:52 +00:00
'' + lib.optionalString withPass ''
2023-02-18 04:20:00 +00:00
install -Dm755 -t $out/bin bin/pass-import
substituteInPlace $out/bin/pass-import \
--replace pass ${pass}/bin/pass
2020-05-19 16:10:52 +00:00
'';
meta = with lib; {
description = "Unofficial command line client for Bitwarden";
homepage = "https://crates.io/crates/rbw";
2020-12-02 04:20:00 +00:00
changelog = "https://git.tozt.net/rbw/plain/CHANGELOG.md?id=${version}";
2020-05-19 16:10:52 +00:00
license = licenses.mit;
2020-10-17 04:20:00 +00:00
maintainers = with maintainers; [ albakham luc65r marsam ];
2020-05-19 16:10:52 +00:00
};
}