2020-01-27 07:16:42 -08:00
|
|
|
{ stdenv, rustPlatform, fetchFromGitHub
|
|
|
|
, pkgconfig, openssl
|
|
|
|
, Security, CoreServices
|
|
|
|
, dbBackend ? "sqlite", libmysqlclient, postgresql }:
|
2019-04-23 12:25:46 -07:00
|
|
|
|
2020-01-27 07:16:42 -08:00
|
|
|
let
|
|
|
|
featuresFlag = "--features ${dbBackend}";
|
|
|
|
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
2019-04-23 12:25:46 -07:00
|
|
|
pname = "bitwarden_rs";
|
2020-03-14 09:15:12 -07:00
|
|
|
version = "1.14";
|
2019-04-23 12:25:46 -07:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dani-garcia";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-03-14 09:15:12 -07:00
|
|
|
sha256 = "1ck0l0167kw1i5fjn507g4d18x2krbpk2ks0lnw9vzg0bwnzzwwd";
|
2019-04-23 12:25:46 -07:00
|
|
|
};
|
|
|
|
|
2019-05-12 02:26:11 -07:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2020-01-27 07:16:42 -08:00
|
|
|
buildInputs = with stdenv.lib; [ openssl ]
|
|
|
|
++ optionals stdenv.isDarwin [ Security CoreServices ]
|
|
|
|
++ optional (dbBackend == "mysql") libmysqlclient
|
|
|
|
++ optional (dbBackend == "postgresql") postgresql;
|
2019-04-23 12:25:46 -07:00
|
|
|
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
2020-03-14 09:15:12 -07:00
|
|
|
cargoSha256 = "0cgk61dmc057p82g0apd4sx6a8vhvcipxikrdb0hds4frhqsr6i8";
|
2020-01-27 07:16:42 -08:00
|
|
|
cargoBuildFlags = [ featuresFlag ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
echo "Running cargo cargo test ${featuresFlag} -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}"
|
|
|
|
cargo test ${featuresFlag} -- ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"}
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2019-04-23 12:25:46 -07:00
|
|
|
|
2019-05-12 07:54:30 -07:00
|
|
|
meta = with stdenv.lib; {
|
2020-01-27 07:16:42 -08:00
|
|
|
description = "Unofficial Bitwarden compatible server written in Rust";
|
|
|
|
homepage = "https://github.com/dani-garcia/bitwarden_rs";
|
2019-04-23 12:25:46 -07:00
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ msteen ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|