2026-06-18 12:53:36 -04:00
|
|
|
{
|
|
|
|
|
hello,
|
|
|
|
|
lib,
|
2026-07-10 21:48:42 -04:00
|
|
|
pkgs,
|
|
|
|
|
rust-overlay,
|
2026-06-18 12:53:36 -04:00
|
|
|
|
|
|
|
|
targetBins ? [ ],
|
|
|
|
|
features ? [ ],
|
|
|
|
|
cargoBuildTarget ? null,
|
|
|
|
|
buildType ? null,
|
|
|
|
|
buildLib ? false,
|
|
|
|
|
}:
|
|
|
|
|
let
|
|
|
|
|
cargoToml = (lib.importTOML ../Cargo.toml);
|
2026-07-10 21:48:42 -04:00
|
|
|
rustPlatformFor =
|
|
|
|
|
pkgs:
|
|
|
|
|
let
|
|
|
|
|
rust-bin = rust-overlay.lib.mkRustBin { } pkgs;
|
|
|
|
|
rustToolchain = (rust-bin.fromRustupToolchainFile ../rust-toolchain.toml).override (
|
|
|
|
|
if cargoBuildTarget != null then
|
|
|
|
|
{
|
|
|
|
|
targets = [ cargoBuildTarget ];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ }
|
|
|
|
|
);
|
|
|
|
|
baseRustPlatform = (
|
|
|
|
|
pkgs.makeRustPlatform {
|
|
|
|
|
cargo = rustToolchain;
|
|
|
|
|
rustc = rustToolchain;
|
2026-06-18 12:53:36 -04:00
|
|
|
}
|
2026-07-10 21:48:42 -04:00
|
|
|
);
|
|
|
|
|
rustPlatform =
|
|
|
|
|
if cargoBuildTarget != null then
|
|
|
|
|
baseRustPlatform.overrideScope (
|
|
|
|
|
final: prev: {
|
|
|
|
|
cargoBuildHook = prev.cargoBuildHook.overrideDerivation (_: {
|
|
|
|
|
rustcTargetSpec = cargoBuildTarget;
|
|
|
|
|
});
|
|
|
|
|
cargoInstallHook = hello;
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
else
|
|
|
|
|
baseRustPlatform;
|
|
|
|
|
in
|
|
|
|
|
rustPlatform;
|
2026-06-18 12:53:36 -04:00
|
|
|
in
|
2026-07-10 21:48:42 -04:00
|
|
|
(rustPlatformFor pkgs).buildRustPackage (
|
|
|
|
|
# rustPlatform.buildRustPackage (
|
2026-06-18 12:53:36 -04:00
|
|
|
{
|
|
|
|
|
pname = "organic";
|
|
|
|
|
version = cargoToml.package.version;
|
|
|
|
|
src = lib.cleanSource ../.;
|
|
|
|
|
|
|
|
|
|
cargoLock.lockFile = ../Cargo.lock;
|
|
|
|
|
|
|
|
|
|
cargoBuildFlags = builtins.concatLists [
|
|
|
|
|
(builtins.concatMap (targetBin: [
|
|
|
|
|
"--bin"
|
|
|
|
|
targetBin
|
|
|
|
|
]) targetBins)
|
|
|
|
|
(if buildLib then [ "--lib" ] else [ ])
|
|
|
|
|
(
|
|
|
|
|
if features != [ ] then
|
|
|
|
|
[
|
|
|
|
|
"--features"
|
|
|
|
|
(builtins.concatStringsSep " " features)
|
|
|
|
|
]
|
|
|
|
|
else
|
|
|
|
|
[ ]
|
|
|
|
|
)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
// (
|
|
|
|
|
if buildType != null then
|
|
|
|
|
{
|
|
|
|
|
buildType = buildType;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ }
|
|
|
|
|
)
|
|
|
|
|
)
|