chore: rewrite continuwuity build

This commit is contained in:
Henry-Hiles
2026-04-07 20:41:19 +00:00
committed by Henry Hiles
parent db1b08532e
commit ec5f50c68e
6 changed files with 48 additions and 297 deletions
+48 -11
View File
@@ -1,16 +1,53 @@
{ inputs, ... }:
{
imports = [
./continuwuity
./rust.nix
./uwulib
];
perSystem =
{ self', pkgs, ... }:
{
packages = {
default = self'.packages.continuwuity-default-bin;
rocksdb = pkgs.callPackage ./rocksdb.nix { };
};
self',
pkgs,
lib,
...
}:
{
packages =
let
crane = self'.packages.crane;
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;
isRust = crane.filterCargoSources;
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";
};
common = {
inherit src;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.liburing ];
env.LIBCLANG_PATH = lib.makeLibraryPath [ pkgs.llvmPackages.libclang.lib ];
};
cargoArtifacts = crane.buildDepsOnly common;
continuwuity = crane.buildPackage (
common
// {
inherit cargoArtifacts;
doCheck = false;
env.LIBCLANG_PATH = lib.makeLibraryPath [ pkgs.llvmPackages.libclang.lib ];
}
);
in
{
default = continuwuity;
rocksdb = pkgs.callPackage ./rocksdb.nix { };
};
};
}