summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-07-13 10:33:30 +0200
committerpennae <github@quasiparticle.net>2022-07-13 13:27:12 +0200
commit2f8dce44d3f2be74b5c6ec0a2e7f4ceced715328 (patch)
treecaff55807c5fc773a36aa773cfde9cd6ebbbb6c8 /default.nix
downloadminor-skulk-2f8dce44d3f2be74b5c6ec0a2e7f4ceced715328.tar.gz
minor-skulk-2f8dce44d3f2be74b5c6ec0a2e7f4ceced715328.tar.xz
minor-skulk-2f8dce44d3f2be74b5c6ec0a2e7f4ceced715328.zip
initial import
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..1942086
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,54 @@
+{ stdenv
+, rustPlatform
+, rust
+, lib
+, openssl
+, pkg-config
+, postgresql
+, postgresqlTestHook
+, python3
+}:
+
+rustPlatform.buildRustPackage rec {
+ pname = "minor-skulk";
+ version = "0.1.0";
+
+ src = lib.cleanSource ./.;
+
+ nativeBuildInputs = [
+ pkg-config
+ ];
+ checkInputs = [
+ openssl
+ postgresql
+ postgresqlTestHook
+ (python3.withPackages (p: [ p.pytest p.pyfxa p.requests p.http-ece p.aiosmtpd ]))
+ ];
+ buildInputs = [
+ openssl
+ ];
+
+ postPatch = ''
+ patchShebangs ./tests/run.sh
+ '';
+
+ # tests can't run multithreaded yet
+ dontUseCargoParallelTests = true;
+
+ # test config for postgres hook and integration tests
+ PGDATABASE = "testdb";
+ PGUSER = "testuser";
+ ROCKET_DATABASE_URL = "postgres:///${PGDATABASE}?user=${PGUSER}";
+ ROCKET_LOCATION = "http://localhost:8000";
+ ROCKET_TOKEN_SERVER_LOCATION = "http://localhost:5000";
+ ROCKET_VAPID_KEY = "private_key.pem";
+ ROCKET_VAPID_SUBJECT = "undefined"; # not needed for tests
+ ROCKET_MAIL_FROM = "minor skulk <noreply@localhost>";
+ ROCKET_MAIL_PORT = 2525;
+
+ preCheck = ''
+ openssl ecparam -genkey -name prime256v1 -out private_key.pem
+ '';
+
+ cargoLock.lockFile = ./Cargo.lock;
+}