From 8a1c4afe9726e3502d8d58db24643424bd40d7ff Mon Sep 17 00:00:00 2001 From: Nick Hu Date: Mon, 7 Mar 2022 23:12:18 +0000 Subject: [PATCH] don't strip [lib] TOML --- lib.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib.nix b/lib.nix index 68ae3b12..c97ba758 100644 --- a/lib.nix +++ b/lib.nix @@ -174,7 +174,7 @@ rec attrs = # Since we pretend everything is a lib, we remove any mentions # of binaries - removeAttrs cargotoml [ "bin" "example" "lib" "test" "bench" "default-run" ] + removeAttrs cargotoml [ "bin" "example" "test" "bench" "default-run" ] // lib.optionalAttrs (builtins.hasAttr "package" cargotoml) ({ package = removeAttrs cargotoml.package [ "default-run" ] ; }) ; in @@ -209,7 +209,11 @@ rec pushd $out/$member > /dev/null mkdir -p src # Avoid accidentally pulling `std` for no-std crates. - echo '#![no_std]' >src/lib.rs + cat <src/lib.rs + #![no_std] + #[panic_handler] + fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} } + EOF # pretend there's a `build.rs`, otherwise cargo doesn't build # the `[build-dependencies]`. Custom locations of build scripts # aren't an issue because we strip the `build` field in