47 lines
1.4 KiB
Nix
47 lines
1.4 KiB
Nix
{ lib, stdenv, rustPlatform, fetchFromGitHub, fetchurl, nixosTests
|
|
, pkg-config, openssl
|
|
, libiconv, Security, CoreServices
|
|
, dbBackend ? "sqlite", libmysqlclient, postgresql }:
|
|
|
|
let
|
|
featuresFlag = "--features ${dbBackend}";
|
|
|
|
in rustPlatform.buildRustPackage rec {
|
|
pname = "vaultwarden";
|
|
version = "1.22.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "dani-garcia";
|
|
repo = pname;
|
|
rev = version;
|
|
sha256 = "sha256-37+Gor3xyo0yb3I4rrleJoPnqTA7G3WmeMSTltthi2E=";
|
|
};
|
|
|
|
cargoSha256 = "sha256-+zu5OfvXj8DMglf5Xv5ZcaUlbE03cwyD8TN7YftgWO0=";
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = with lib; [ openssl ]
|
|
++ optionals stdenv.isDarwin [ libiconv Security CoreServices ]
|
|
++ optional (dbBackend == "mysql") libmysqlclient
|
|
++ optional (dbBackend == "postgresql") postgresql;
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
cargoBuildFlags = [ featuresFlag ];
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
echo "Running cargo cargo test ${featuresFlag} -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}"
|
|
cargo test ${featuresFlag} -- ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"}
|
|
runHook postCheck
|
|
'';
|
|
|
|
passthru.tests = nixosTests.vaultwarden;
|
|
|
|
meta = with lib; {
|
|
description = "Unofficial Bitwarden compatible server written in Rust";
|
|
homepage = "https://github.com/dani-garcia/vaultwarden";
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ msteen ];
|
|
};
|
|
}
|