Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, callPackage, rustPlatform, fetchFromGitHub, fetchurl, nixosTests 2, pkg-config, openssl 3, libiconv, Security, CoreServices 4, dbBackend ? "sqlite", libmysqlclient, postgresql }: 5 6let 7 webvault = callPackage ./webvault.nix {}; 8in 9 10rustPlatform.buildRustPackage rec { 11 pname = "vaultwarden"; 12 version = "1.28.1"; 13 14 src = fetchFromGitHub { 15 owner = "dani-garcia"; 16 repo = pname; 17 rev = version; 18 hash = "sha256-YIR8if6lFJ+534qBN9k1ltFp5M7KBU5qYaI1KppTYwI="; 19 }; 20 21 cargoLock = { 22 lockFile = ./Cargo.lock; 23 }; 24 25 nativeBuildInputs = [ pkg-config ]; 26 buildInputs = with lib; [ openssl ] 27 ++ optionals stdenv.isDarwin [ libiconv Security CoreServices ] 28 ++ optional (dbBackend == "mysql") libmysqlclient 29 ++ optional (dbBackend == "postgresql") postgresql; 30 31 buildFeatures = dbBackend; 32 33 passthru = { 34 inherit webvault; 35 tests = nixosTests.vaultwarden; 36 updateScript = callPackage ./update.nix {}; 37 }; 38 39 meta = with lib; { 40 description = "Unofficial Bitwarden compatible server written in Rust"; 41 homepage = "https://github.com/dani-garcia/vaultwarden"; 42 license = licenses.agpl3Only; 43 maintainers = with maintainers; [ msteen ivan ]; 44 }; 45}