2026-03-30 21:23:00 -04:00
|
|
|
{ inputs, ... }:
|
2025-09-24 14:33:20 +02:00
|
|
|
{
|
2025-10-21 19:17:55 +02:00
|
|
|
perSystem =
|
|
|
|
|
{
|
2026-03-30 22:19:33 -04:00
|
|
|
craneLib,
|
2026-03-30 21:23:00 -04:00
|
|
|
self',
|
|
|
|
|
pkgs,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
{
|
|
|
|
|
packages =
|
|
|
|
|
let
|
|
|
|
|
src =
|
|
|
|
|
let
|
|
|
|
|
# see https://crane.dev/API.html#cranelibfiltercargosources
|
|
|
|
|
# we need to keep the `web` directory which would be filtered out by the regular source filtering function
|
|
|
|
|
# https://crane.dev/API.html#cranelibcleancargosource
|
|
|
|
|
isWebTemplate = path: _type: builtins.match ".*(src/(web|service)|docs).*" path != null;
|
2026-03-30 22:19:33 -04:00
|
|
|
isRust = craneLib.filterCargoSources;
|
2026-03-30 21:23:00 -04:00
|
|
|
isNix = path: _type: builtins.match ".+/nix.*" path != null;
|
|
|
|
|
webOrRustNotNix = p: t: !(isNix p t) && (isWebTemplate p t || isRust p t);
|
|
|
|
|
in
|
|
|
|
|
lib.cleanSourceWith {
|
|
|
|
|
src = inputs.self;
|
|
|
|
|
filter = webOrRustNotNix;
|
|
|
|
|
name = "source";
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-31 15:07:43 -04:00
|
|
|
rocksdb = pkgs.callPackage ./rocksdb.nix { };
|
|
|
|
|
|
|
|
|
|
attrs = {
|
2026-03-30 21:23:00 -04:00
|
|
|
inherit src;
|
2026-03-31 10:22:13 -04:00
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
|
pkg-config
|
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
|
];
|
2026-03-31 15:07:43 -04:00
|
|
|
buildInputs = [
|
|
|
|
|
pkgs.liburing
|
|
|
|
|
];
|
|
|
|
|
env = {
|
|
|
|
|
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
|
|
|
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
|
|
|
|
};
|
2026-03-30 21:23:00 -04:00
|
|
|
};
|
|
|
|
|
|
2026-03-31 15:07:43 -04:00
|
|
|
cargoArtifacts = craneLib.buildDepsOnly attrs;
|
2026-03-31 10:32:14 -04:00
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
default = craneLib.buildPackage (
|
2026-03-31 15:07:43 -04:00
|
|
|
lib.recursiveUpdate attrs {
|
2026-03-30 21:23:00 -04:00
|
|
|
inherit cargoArtifacts;
|
2026-03-31 15:07:43 -04:00
|
|
|
|
|
|
|
|
# Needed to make continuwuity link to rocksdb
|
|
|
|
|
postFixup = ''
|
|
|
|
|
old_rpath="$(patchelf --print-rpath $out/bin/conduwuit)"
|
|
|
|
|
extra_rpath="${
|
|
|
|
|
pkgs.lib.makeLibraryPath [
|
|
|
|
|
pkgs.rocksdb
|
|
|
|
|
]
|
|
|
|
|
}"
|
|
|
|
|
|
|
|
|
|
patchelf --set-rpath "$old_rpath:$extra_rpath" $out/bin/conduwuit
|
|
|
|
|
'';
|
2026-03-31 10:32:14 -04:00
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
|
description = "A community-driven Matrix homeserver in Rust";
|
|
|
|
|
mainProgram = "conduwuit";
|
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
|
maintainers = with lib.maintainers; [ quadradical ];
|
|
|
|
|
};
|
2026-03-30 21:23:00 -04:00
|
|
|
}
|
|
|
|
|
);
|
2026-03-30 22:16:43 -04:00
|
|
|
inherit rocksdb;
|
2026-03-30 21:23:00 -04:00
|
|
|
};
|
2025-10-21 19:17:55 +02:00
|
|
|
};
|
2025-09-24 14:33:20 +02:00
|
|
|
}
|