1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{ stdenv, lib, naersk, lld, mold, typescript
, useWebAuthn ? false, openssl, zlib, pkg-config, protobuf
, usePostgres ? true, postgresql, postgresqlTestHook
, nixosTests }:
assert useWebAuthn -> openssl != null && pkg-config != null;
assert usePostgres -> postgresql != null && postgresqlTestHook != null;
naersk.buildPackage {
pname = "kittybox";
version = "0.1.0";
src = ./kittybox-rs;
doCheck = stdenv.hostPlatform == stdenv.targetPlatform;
cargoOptions = x: x ++ (lib.optionals useWebAuthn [
"--no-default-features" "--features=\"webauthn${lib.optionalString usePostgres " sqlx"}\""
]);
buildInputs = lib.optional useWebAuthn openssl;
nativeBuildInputs = [ typescript ] ++ (lib.optional useWebAuthn pkg-config);
nativeCheckInputs = lib.optionals usePostgres [
postgresql postgresqlTestHook
];
# Tests create arbitrary databases; we need to be prepared for that
postgresqlTestUserOptions = "LOGIN SUPERUSER";
postgresqlTestSetupPost = ''
export DATABASE_URL="postgres://localhost?host=$PGHOST&user=$PGUSER&dbname=$PGDATABASE"
'';
passthru = {
tests = nixosTests;
hasPostgres = usePostgres;
};
meta = with lib.meta; {
maintainers = with lib.maintainers; [ vikanezrimaya ];
platforms = ["aarch64-linux" "x86_64-linux"];
mainProgram = "kittybox";
};
}
|