Files
continuwuity/nix/packages/default.nix
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
2.3 KiB
Nix
Raw Normal View History

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";
};
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
];
buildInputs = [
pkgs.liburing
];
env = {
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
};
2026-03-30 21:23:00 -04:00
};
cargoArtifacts = craneLib.buildDepsOnly attrs;
2026-03-31 10:32:14 -04:00
in
{
default = craneLib.buildPackage (
lib.recursiveUpdate attrs {
2026-03-30 21:23:00 -04:00
inherit cargoArtifacts;
# 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
}