{ hello, lib, makeRustPlatform, pkgsBuildHost, targetBins ? [ ], features ? [ ], cargoBuildTarget ? null, buildType ? null, buildLib ? false, }: let cargoToml = (lib.importTOML ../Cargo.toml); rustToolchain = (pkgsBuildHost.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml).override ( if cargoBuildTarget != null then { targets = [ cargoBuildTarget ]; } else { } ); baseRustPlatform = ( makeRustPlatform { cargo = rustToolchain; rustc = rustToolchain; } ); rustPlatform = if cargoBuildTarget != null then baseRustPlatform.overrideScope ( final: prev: { cargoBuildHook = prev.cargoBuildHook.overrideDerivation (_: { rustcTargetSpec = cargoBuildTarget; }); cargoInstallHook = hello; } ) else baseRustPlatform; in rustPlatform.buildRustPackage ( { 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 { } ) )