about summary refs log tree commit diff
path: root/kittybox.nix
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-09-19 19:01:06 +0300
committerVika <vika@fireburn.ru>2022-09-19 19:01:06 +0300
commit53c868691a09b84d71f724d23a09d1fb89368792 (patch)
treee5593882f3c9d4141a2cb796d48dc98b84411d20 /kittybox.nix
parentde105ec7a56752c152e3020fa53a0e13206f4cb4 (diff)
Make webauthn and openssl optional
Diffstat (limited to 'kittybox.nix')
-rw-r--r--kittybox.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/kittybox.nix b/kittybox.nix
index e61843b..397e057 100644
--- a/kittybox.nix
+++ b/kittybox.nix
@@ -1,4 +1,9 @@
-{ stdenv, lib, openssl, zlib, pkg-config, protobuf, naersk, lld, mold }:
+{ stdenv, lib, naersk, lld, mold
+, openssl, zlib, pkg-config, protobuf
+, useWebAuthn ? false }:
+
+assert useWebAuthn -> openssl != null && pkg-config != null;
+
 naersk.buildPackage {
   pname = "kittybox";
   version = "0.1.0";
@@ -6,6 +11,11 @@ naersk.buildPackage {
   src = ./kittybox-rs;
 
   doCheck = stdenv.hostPlatform == stdenv.targetPlatform;
+  cargoOptions = x: x ++ (lib.optionals useWebAuthn [
+    "--no-default-features" "--features=\"webauthn\""
+  ]);
+  buildInputs = lib.optional useWebAuthn openssl;
+  nativeBuildInputs = lib.optional useWebAuthn pkg-config;
 
   meta = with lib.meta; {
     maintainers = with lib.maintainers; [ vikanezrimaya ];