about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/vaultwarden/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/vaultwarden/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/vaultwarden/default.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/vaultwarden/default.nix b/nixpkgs/pkgs/tools/security/vaultwarden/default.nix
new file mode 100644
index 000000000000..762c8312c1e6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/vaultwarden/default.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, callPackage, rustPlatform, fetchFromGitHub, nixosTests
+, pkg-config, openssl
+, libiconv, Security, CoreServices, SystemConfiguration
+, dbBackend ? "sqlite", libmysqlclient, postgresql }:
+
+let
+  webvault = callPackage ./webvault.nix {};
+in
+
+rustPlatform.buildRustPackage rec {
+  pname = "vaultwarden";
+  version = "1.30.1";
+
+  src = fetchFromGitHub {
+    owner = "dani-garcia";
+    repo = pname;
+    rev = version;
+    hash = "sha256-9JCrEe0tla4v207XPgprLqP3g0BslpX8f7xa9aUhQcg=";
+  };
+
+  cargoHash = "sha256-4KyBMOdTAHe5uD6X69gMd0aqIo4w2Rqrlg+25yY2B6o=";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = with lib; [ openssl ]
+    ++ optionals stdenv.isDarwin [ libiconv Security CoreServices SystemConfiguration ]
+    ++ optional (dbBackend == "mysql") libmysqlclient
+    ++ optional (dbBackend == "postgresql") postgresql;
+
+  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.agpl3Only;
+    maintainers = with maintainers; [ msteen ivan ];
+    mainProgram = "vaultwarden";
+  };
+}