Compare commits
1 commit
alpine-pac
...
strawberry
Author | SHA1 | Date | |
---|---|---|---|
|
fc2d051477 |
6 changed files with 101 additions and 31 deletions
|
@ -34,7 +34,9 @@ toplevel="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
pushd "$toplevel" > /dev/null
|
pushd "$toplevel" > /dev/null
|
||||||
|
|
||||||
bin/nix-build-and-cache just .#linux-complement
|
#bin/nix-build-and-cache just .#linux-complement
|
||||||
|
bin/nix-build-and-cache just .#complement
|
||||||
|
#nom build .#complement
|
||||||
|
|
||||||
docker load < result
|
docker load < result
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
|
|
|
@ -169,10 +169,10 @@
|
||||||
|
|
||||||
# used for rust caching in CI to speed it up
|
# used for rust caching in CI to speed it up
|
||||||
sccache
|
sccache
|
||||||
|
|
||||||
# needed so we can get rid of gcc and other unused deps that bloat OCI images
|
|
||||||
removeReferencesTo
|
|
||||||
]
|
]
|
||||||
|
# valgrind is unavailable in static contexts
|
||||||
|
# used for CI and complement
|
||||||
|
++ (if !stdenv.hostPlatform.isStatic then [ "valgrind" ] else [])
|
||||||
# liburing is Linux-exclusive
|
# liburing is Linux-exclusive
|
||||||
++ lib.optional stdenv.hostPlatform.isLinux liburing
|
++ lib.optional stdenv.hostPlatform.isLinux liburing
|
||||||
# needed to build Rust applications on macOS
|
# needed to build Rust applications on macOS
|
||||||
|
|
|
@ -17,19 +17,30 @@ ip_range_denylist = []
|
||||||
url_preview_domain_contains_allowlist = ["*"]
|
url_preview_domain_contains_allowlist = ["*"]
|
||||||
url_preview_domain_explicit_denylist = ["*"]
|
url_preview_domain_explicit_denylist = ["*"]
|
||||||
media_compat_file_link = false
|
media_compat_file_link = false
|
||||||
media_startup_check = false
|
media_startup_check = true
|
||||||
prune_missing_media = false
|
prune_missing_media = true
|
||||||
log_colors = false
|
log_colors = false
|
||||||
admin_room_notices = false
|
admin_room_notices = false
|
||||||
allow_check_for_updates = false
|
allow_check_for_updates = false
|
||||||
allow_unstable_room_versions = true
|
|
||||||
rocksdb_log_level = "debug"
|
rocksdb_log_level = "debug"
|
||||||
rocksdb_max_log_files = 1
|
rocksdb_max_log_files = 1
|
||||||
rocksdb_recovery_mode = 0
|
rocksdb_recovery_mode = 0
|
||||||
rocksdb_paranoid_file_checks = true
|
rocksdb_paranoid_file_checks = true
|
||||||
log_guest_registrations = false
|
log_guest_registrations = false
|
||||||
allow_legacy_media = true
|
allow_legacy_media = true
|
||||||
startup_netburst = false
|
startup_netburst = true
|
||||||
|
|
||||||
|
# valgrind makes things so slow
|
||||||
|
dns_timeout = 60
|
||||||
|
dns_attempts = 20
|
||||||
|
request_conn_timeout = 60
|
||||||
|
request_timeout = 120
|
||||||
|
well_known_conn_timeout = 60
|
||||||
|
well_known_timeout = 60
|
||||||
|
federation_idle_timeout = 300
|
||||||
|
sender_timeout = 300
|
||||||
|
sender_idle_timeout = 300
|
||||||
|
sender_retry_backoff_limit = 300
|
||||||
|
|
||||||
[global.tls]
|
[global.tls]
|
||||||
certs = "/certificate.crt"
|
certs = "/certificate.crt"
|
||||||
|
|
|
@ -9,19 +9,22 @@
|
||||||
, openssl
|
, openssl
|
||||||
, stdenv
|
, stdenv
|
||||||
, tini
|
, tini
|
||||||
|
, valgrind
|
||||||
, writeShellScriptBin
|
, writeShellScriptBin
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
main' = main.override {
|
main' = main.override {
|
||||||
profile = "test";
|
#profile = "test";
|
||||||
|
profile = "release-debuginfo";
|
||||||
all_features = true;
|
all_features = true;
|
||||||
disable_release_max_log_level = true;
|
disable_release_max_log_level = true;
|
||||||
disable_features = [
|
disable_features = [
|
||||||
# no reason to use jemalloc for complement, just has compatibility/build issues
|
|
||||||
"jemalloc"
|
"jemalloc"
|
||||||
"jemalloc_stats"
|
"jemalloc_stats"
|
||||||
"jemalloc_prof"
|
"jemalloc_prof"
|
||||||
|
"jemalloc_conf"
|
||||||
|
"io_uring"
|
||||||
# console/CLI stuff isn't used or relevant for complement
|
# console/CLI stuff isn't used or relevant for complement
|
||||||
"console"
|
"console"
|
||||||
"tokio_console"
|
"tokio_console"
|
||||||
|
@ -29,7 +32,7 @@ let
|
||||||
"sentry_telemetry"
|
"sentry_telemetry"
|
||||||
"perf_measurements"
|
"perf_measurements"
|
||||||
# the containers don't use or need systemd signal support
|
# the containers don't use or need systemd signal support
|
||||||
"systemd"
|
#"systemd"
|
||||||
# this is non-functional on nix for some reason
|
# this is non-functional on nix for some reason
|
||||||
"hardened_malloc"
|
"hardened_malloc"
|
||||||
# dont include experimental features
|
# dont include experimental features
|
||||||
|
@ -44,8 +47,50 @@ let
|
||||||
"url_preview"
|
"url_preview"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
# TODO: figure out why a suspicious amounnt of complement tests fail with valgrind only under complement.
|
||||||
|
# maybe issue with direct TLS mode?
|
||||||
|
#${lib.getExe' valgrind "valgrind"} \
|
||||||
|
#--leak-check=no \
|
||||||
|
#--undef-value-errors=no \
|
||||||
|
#--exit-on-first-error=yes \
|
||||||
|
#--error-exitcode=1 \
|
||||||
|
|
||||||
start = writeShellScriptBin "start" ''
|
# valgrind only works in non-static ocntexts
|
||||||
|
start = if !stdenv.hostPlatform.isStatic then writeShellScriptBin "start" ''
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
${lib.getExe openssl} genrsa -out private_key.key 2048
|
||||||
|
${lib.getExe openssl} req \
|
||||||
|
-new \
|
||||||
|
-sha256 \
|
||||||
|
-key private_key.key \
|
||||||
|
-subj "/C=US/ST=CA/O=MyOrg, Inc./CN=$SERVER_NAME" \
|
||||||
|
-out signing_request.csr
|
||||||
|
cp ${./v3.ext} v3.ext
|
||||||
|
echo "DNS.1 = $SERVER_NAME" >> v3.ext
|
||||||
|
echo "IP.1 = $(${lib.getExe gawk} 'END{print $1}' /etc/hosts)" \
|
||||||
|
>> v3.ext
|
||||||
|
${lib.getExe openssl} x509 \
|
||||||
|
-req \
|
||||||
|
-extfile v3.ext \
|
||||||
|
-in signing_request.csr \
|
||||||
|
-CA /complement/ca/ca.crt \
|
||||||
|
-CAkey /complement/ca/ca.key \
|
||||||
|
-CAcreateserial \
|
||||||
|
-out certificate.crt \
|
||||||
|
-days 1 \
|
||||||
|
-sha256
|
||||||
|
|
||||||
|
${lib.getExe' coreutils "env"} \
|
||||||
|
CONDUWUIT_SERVER_NAME="$SERVER_NAME" \
|
||||||
|
TMPDIR="/" \
|
||||||
|
${lib.getExe' valgrind "valgrind"} \
|
||||||
|
--leak-check=no \
|
||||||
|
--undef-value-errors=no \
|
||||||
|
--exit-on-first-error=yes \
|
||||||
|
--error-exitcode=1 \
|
||||||
|
${lib.getExe main'}
|
||||||
|
'' else writeShellScriptBin "start" ''
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
${lib.getExe openssl} genrsa -out private_key.key 2048
|
${lib.getExe openssl} genrsa -out private_key.key 2048
|
||||||
|
@ -90,6 +135,7 @@ dockerTools.buildImage {
|
||||||
coreutils
|
coreutils
|
||||||
main'
|
main'
|
||||||
start
|
start
|
||||||
|
valgrind
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ rust-jemalloc-sys' = (rust-jemalloc-sys.override {
|
||||||
buildDepsOnlyEnv =
|
buildDepsOnlyEnv =
|
||||||
let
|
let
|
||||||
rocksdb' = (rocksdb.override {
|
rocksdb' = (rocksdb.override {
|
||||||
jemalloc = rust-jemalloc-sys';
|
jemalloc = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
|
||||||
# rocksdb fails to build with prefixed jemalloc, which is required on
|
# rocksdb fails to build with prefixed jemalloc, which is required on
|
||||||
# darwin due to [1]. In this case, fall back to building rocksdb with
|
# darwin due to [1]. In this case, fall back to building rocksdb with
|
||||||
# libc malloc. This should not cause conflicts, because all of the
|
# libc malloc. This should not cause conflicts, because all of the
|
||||||
|
@ -103,6 +103,11 @@ buildDepsOnlyEnv =
|
||||||
++ [ "-DPORTABLE=haswell" ]) else ([ "-DPORTABLE=1" ])
|
++ [ "-DPORTABLE=haswell" ]) else ([ "-DPORTABLE=1" ])
|
||||||
)
|
)
|
||||||
++ old.cmakeFlags;
|
++ old.cmakeFlags;
|
||||||
|
# outputs has "tools" which we dont need or use
|
||||||
|
outputs = [ "out" ];
|
||||||
|
|
||||||
|
# preInstall hooks has stuff for messing with ldb/sst_dump which we dont need or use
|
||||||
|
preInstall = "";
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -156,6 +161,19 @@ commonAttrs = {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# This is redundant with CI
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
cargoTestCommand = "cargo test --locked ";
|
||||||
|
cargoExtraArgs = "--no-default-features --locked "
|
||||||
|
+ lib.optionalString
|
||||||
|
(features'' != [])
|
||||||
|
"--features " + (builtins.concatStringsSep "," features'');
|
||||||
|
cargoTestExtraArgs = "--no-default-features --locked "
|
||||||
|
+ lib.optionalString
|
||||||
|
(features'' != [])
|
||||||
|
"--features " + (builtins.concatStringsSep "," features'');
|
||||||
|
|
||||||
dontStrip = profile == "dev" || profile == "test";
|
dontStrip = profile == "dev" || profile == "test";
|
||||||
dontPatchELF = profile == "dev" || profile == "test";
|
dontPatchELF = profile == "dev" || profile == "test";
|
||||||
|
|
||||||
|
@ -181,9 +199,6 @@ commonAttrs = {
|
||||||
# differing values for `NIX_CFLAGS_COMPILE`, which contributes to spurious
|
# differing values for `NIX_CFLAGS_COMPILE`, which contributes to spurious
|
||||||
# rebuilds of bindgen and its depedents.
|
# rebuilds of bindgen and its depedents.
|
||||||
jq
|
jq
|
||||||
|
|
||||||
# needed so we can get rid of gcc and other unused deps that bloat OCI images
|
|
||||||
removeReferencesTo
|
|
||||||
]
|
]
|
||||||
# needed to build Rust applications on macOS
|
# needed to build Rust applications on macOS
|
||||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||||
|
@ -195,13 +210,6 @@ commonAttrs = {
|
||||||
# https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
|
# https://discourse.nixos.org/t/compile-a-rust-binary-on-macos-dbcrossbar/8612
|
||||||
pkgsBuildHost.darwin.apple_sdk.frameworks.Security
|
pkgsBuildHost.darwin.apple_sdk.frameworks.Security
|
||||||
];
|
];
|
||||||
|
|
||||||
# for some reason gcc and other weird deps are added to OCI images and bloats it up
|
|
||||||
#
|
|
||||||
# <https://github.com/input-output-hk/haskell.nix/issues/829>
|
|
||||||
postInstall = with pkgsBuildHost; ''
|
|
||||||
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} -t ${gcc} -t ${llvm} -t ${rustc.unwrapped} -t ${rustc} '{}' +
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -210,15 +218,18 @@ craneLib.buildPackage ( commonAttrs // {
|
||||||
env = buildDepsOnlyEnv;
|
env = buildDepsOnlyEnv;
|
||||||
});
|
});
|
||||||
|
|
||||||
cargoExtraArgs = "--no-default-features "
|
# This is redundant with CI
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
cargoTestCommand = "cargo test --locked ";
|
||||||
|
cargoExtraArgs = "--no-default-features --locked "
|
||||||
|
+ lib.optionalString
|
||||||
|
(features'' != [])
|
||||||
|
"--features " + (builtins.concatStringsSep "," features'');
|
||||||
|
cargoTestExtraArgs = "--no-default-features --locked "
|
||||||
+ lib.optionalString
|
+ lib.optionalString
|
||||||
(features'' != [])
|
(features'' != [])
|
||||||
"--features " + (builtins.concatStringsSep "," features'');
|
"--features " + (builtins.concatStringsSep "," features'');
|
||||||
|
|
||||||
# This is redundant with CI
|
|
||||||
cargoTestCommand = "";
|
|
||||||
cargoCheckCommand = "";
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
env = buildPackageEnv;
|
env = buildPackageEnv;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,11 @@ pub(super) async fn serve(
|
||||||
let certs = tls
|
let certs = tls
|
||||||
.certs
|
.certs
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(err!(Config("tls.certs", "Missing required value in tls config section")))?;
|
.ok_or_else(|| err!(Config("tls.certs", "Missing required value in tls config section")))?;
|
||||||
let key = tls
|
let key = tls
|
||||||
.key
|
.key
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(err!(Config("tls.key", "Missing required value in tls config section")))?;
|
.ok_or_else(|| err!(Config("tls.key", "Missing required value in tls config section")))?;
|
||||||
|
|
||||||
// we use ring for ruma and hashing state, but aws-lc-rs is the new default.
|
// we use ring for ruma and hashing state, but aws-lc-rs is the new default.
|
||||||
// without this, TLS mode will panic.
|
// without this, TLS mode will panic.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue