depot/third_party/nixpkgs/pkgs/tools/security/vaultwarden/default.nix
Default email eaf6957cd3 Project import generated by Copybara.
GitOrigin-RevId: 4bb072f0a8b267613c127684e099a70e1f6ff106
2023-03-27 12:17:25 -07:00

52 lines
1.5 KiB
Nix

{ lib, stdenv, callPackage, rustPlatform, fetchFromGitHub, fetchurl, nixosTests
, pkg-config, openssl
, libiconv, Security, CoreServices
, dbBackend ? "sqlite", libmysqlclient, postgresql }:
let
webvault = callPackage ./webvault.nix {};
in
rustPlatform.buildRustPackage rec {
pname = "vaultwarden";
version = "1.27.0";
src = fetchFromGitHub {
owner = "dani-garcia";
repo = pname;
rev = version;
hash = "sha256-QvU1Y3syr6PZbTRebbZF4sEzI4lIj1enJe2F/gGfvQM=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"multer-2.0.4" = "sha256-962onbcPUjkoIGSQTnF8m1fkamwThpPj4uBJ8EqbouQ=";
};
};
nativeBuildInputs = [ pkg-config ];
buildInputs = with lib; [ openssl ]
++ optionals stdenv.isDarwin [ libiconv Security CoreServices ]
++ optional (dbBackend == "mysql") libmysqlclient
++ optional (dbBackend == "postgresql") postgresql;
# vaultwarden depends on rocket v0.5.0-dev, which requires nightly features.
# This may be removed if https://github.com/dani-garcia/vaultwarden/issues/712 is fixed.
RUSTC_BOOTSTRAP = 1;
buildFeatures = dbBackend;
passthru = {
inherit webvault;
tests = nixosTests.vaultwarden;
updateScript = callPackage ./update.nix {};
};
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 ivan ];
};
}