lol
1{ lib, stdenv, callPackage, rustPlatform, fetchFromGitHub, nixosTests
2, pkg-config, openssl
3, libiconv, Security, CoreServices, SystemConfiguration
4, dbBackend ? "sqlite", libmysqlclient, postgresql }:
5
6let
7 webvault = callPackage ./webvault.nix {};
8in
9
10rustPlatform.buildRustPackage rec {
11 pname = "vaultwarden";
12 version = "1.30.5";
13
14 src = fetchFromGitHub {
15 owner = "dani-garcia";
16 repo = pname;
17 rev = version;
18 hash = "sha256-OwFB5ULWBefDHSkUM3nT0v2jcc5vHUvs8Ex0JauDu8w=";
19 };
20
21 cargoHash = "sha256-K0T0uTERjxlI3bGG/Tz6sJ0A08J0ROAhpppdZcdQPB8=";
22
23 # used for "Server Installed" version in admin panel
24 env.VW_VERSION = version;
25
26 nativeBuildInputs = [ pkg-config ];
27 buildInputs = with lib; [ openssl ]
28 ++ optionals stdenv.isDarwin [ libiconv Security CoreServices SystemConfiguration ]
29 ++ optional (dbBackend == "mysql") libmysqlclient
30 ++ optional (dbBackend == "postgresql") postgresql;
31
32 buildFeatures = dbBackend;
33
34 passthru = {
35 inherit webvault;
36 tests = nixosTests.vaultwarden;
37 updateScript = callPackage ./update.nix {};
38 };
39
40 meta = with lib; {
41 description = "Unofficial Bitwarden compatible server written in Rust";
42 homepage = "https://github.com/dani-garcia/vaultwarden";
43 changelog = "https://github.com/dani-garcia/vaultwarden/releases/tag/${version}";
44 license = licenses.agpl3Only;
45 maintainers = with maintainers; [ dotlambda SuperSandro2000 ];
46 mainProgram = "vaultwarden";
47 };
48}