diff options
author | Vika <vika@fireburn.ru> | 2023-07-29 21:25:56 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2023-07-29 21:59:06 +0300 |
commit | 26c2b79f6a6380ae3224e9309b9f3352f5717bd7 (patch) | |
tree | ec384225f77c4412508dc4bf3377a41c9a7121b3 | |
parent | 2297a4940ed55c1e8425f47cf54734818e9ea5b3 (diff) | |
download | kittybox-26c2b79f6a6380ae3224e9309b9f3352f5717bd7.tar.zst |
kittybox.nix: properly set the features and don't rely on defaults
-rw-r--r-- | kittybox.nix | 16 |
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); |