{ pkgs, lib, fenix, ... }: let mkServicepointBindingC = { rustPlatform, buildType, }: rustPlatform.buildRustPackage (finalAttrs: { inherit buildType; pname = "servicepoint-binding-c"; version = "0.15.0"; src = ./.; cargoLock.lockFile = ./Cargo.lock; meta = { description = "C bindings for the servicepoint crate."; homepage = "https://git.berlin.ccc.de/servicepoint/servicepoint-binding-c"; license = lib.licenses.gpl3Plus; pkgConfigModules = [ "servicepoint" ]; }; nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ xz ]; preBuild = '' mkdir -p include export SERVICEPOINT_HEADER_OUT=$(realpath "include") echo "Rust version: $(rustc --version)" echo "preBuild hook: set SERVICEPOINT_HEADER_OUT to $SERVICEPOINT_HEADER_OUT" ''; postInstall = '' cp -r include $out mkdir -p $out/lib/pkgconfig sed "s:\$out:$out:g" ${./servicepoint.pc.in} | sed "s:\$version:$version:g" > $out/lib/pkgconfig/servicepoint.pc ''; }); rustPlatform-stable = pkgs.rustPlatform; rustPlatform-unstable = pkgs.makeRustPlatform { cargo = fenix.minimal.cargo; rustc = fenix.minimal.rustc; }; in rec { servicepoint-binding-c-release = mkServicepointBindingC { buildType = "release"; rustPlatform = rustPlatform-stable; }; servicepoint-binding-c-size-optimized = mkServicepointBindingC { buildType = "size_optimized"; rustPlatform = rustPlatform-unstable; }; servicepoint-binding-c = servicepoint-binding-c-release; }