monorepo/rust.nix

50 lines
969 B
Nix

{ pkgs, craneLib }:
let
src = craneLib.cleanCargoSource ./.;
rustDeps = with pkgs; {
inherit src;
nativeBuildInputs = [
gtk4
pkg-config
pkgs.clang
wrapGAppsHook4
];
buildInputs = [
libadwaita
openssl
pipewire
];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
cargoArtifacts = craneLib.buildDepsOnly rustDeps;
rustArgs = rustDeps // {
inherit cargoArtifacts;
doCheck = false;
};
fileSetForCrate =
crate:
pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./Cargo.toml
./Cargo.lock
(craneLib.fileset.commonCargoSources crate)
];
};
in
{
l10n-db = craneLib.buildPackage (
rustArgs
// {
inherit (craneLib.crateNameFromCargoToml { src = ./l10n-db; }) version;
pname = "l10n-db";
cargoExtraArgs = "-p l10n-db";
src = fileSetForCrate ./l10n-db;
}
);
}