about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--kittybox.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/kittybox.nix b/kittybox.nix
index ccf3ea8..22e774c 100644
--- a/kittybox.nix
+++ b/kittybox.nix
@@ -6,16 +6,22 @@
 assert useWebAuthn -> openssl != null && pkg-config != null;
 assert usePostgres -> postgresql != null && postgresqlTestHook != null;
 
-naersk.buildPackage {
+let
+  featureMatrix = features: lib.concatStringsSep " " (lib.attrNames (lib.filterAttrs (k: v: v) features));
+in
+naersk.buildPackage rec {
   pname = "kittybox";
   version = "0.1.0";
 
-  src = ./kittybox-rs;
+  src = lib.sources.sourceFilesBySuffices ./kittybox-rs [".rs" ".toml" ".sql" ".ts" ".css" ".html" ".lock" ".json"];
 
   doCheck = stdenv.hostPlatform == stdenv.targetPlatform;
-  cargoOptions = x: x ++ (lib.optionals useWebAuthn [
-    "--no-default-features" "--features=\"webauthn${lib.optionalString usePostgres " sqlx"}\""
-  ]);
+  cargoBuildOptions = x: x ++ [
+    "--no-default-features"
+    "--features=\"${featureMatrix { webauthn = useWebAuthn; postgres = usePostgres; rustls = !useWebAuthn; }}\""
+  ];
+  cargoTestOptions = cargoBuildOptions;
+
   buildInputs = lib.optional useWebAuthn openssl;
   nativeBuildInputs = [ typescript ] ++ (lib.optional useWebAuthn pkg-config);