| 5 Jul 2022 |
deep6 | thanks Linux Hackerman | 08:33:58 |
deep6 | oh and thanks as well kraem | 08:42:03 |
deep6 | sorry forgot you there earlier :) | 08:42:06 |
| akadude left the room. | 11:59:35 |
| 6 Jul 2022 |
| kevin joined the room. | 00:15:05 |
kevin | What's the recommended way to package crates currently? I've used like 6 different things over the last two years lol | 00:20:46 |
| Artturin joined the room. | 18:06:52 |
| 8 Jul 2022 |
| biohazard6743 joined the room. | 18:06:11 |
| David joined the room. | 20:01:07 |
| 12 Jul 2022 |
| Janne Heß joined the room. | 07:20:08 |
| Janne Heß left the room. | 07:21:12 |
| 13 Jul 2022 |
| pennae joined the room. | 08:17:44 |
pennae | if we want to package a rust thing with tests that have to run the compiled binary multiple times with different sets of flags, what's the best way to do that? | 08:18:18 |
pennae | running target/${rust.toRustTargetSpec stdenv.hostPlatform}/release/$thing doesn't seem like it's the intended solution | 08:20:01 |
Alyssa Ross | What does upstream do? | 08:32:40 |
pennae | it's a webservice that has a test suite for its rest api, can run in two different modes of lockdown with two different sets of tests | 08:34:36 |
pennae | we are upstream, so all changes to make this easy are on the table | 08:34:50 |
Alyssa Ross | Is it possible a library interface that you could pass the options to, so you don't have to run the compiled binary? | 08:36:19 |
Alyssa Ross | Alternatively, I think cargo integration tests give you the binary path? | 08:36:39 |
pennae | pretty much have to run the binary, part of what we're testing is how the client reacts to the responses | 08:36:42 |
Alyssa Ross | > Binary targets are automatically built if there is an integration test. This allows an integration test to execute the binary to exercise and test its behavior. The CARGO_BIN_EXE_<name> environment variable is set when the integration test is built so that it can use the env macro to locate the executable. | 08:37:38 |
Alyssa Ross | https://doc.rust-lang.org/cargo/reference/cargo-targets.html#integration-tests | 08:37:44 |
pennae | ah, that sounds like it's just the thing :) | 08:38:03 |
pennae | will give that a shot, tyvm | 08:38:28 |
pennae | yeah, this is much better than what we had before :) | 09:32:26 |
Alyssa Ross | yay :) | 09:32:46 |
pennae | (even if it's still mostly doing some setup and calling python 😅) | 09:32:56 |
| 14 Jul 2022 |
@grahamc:nixos.org | I have a shell that comes from this use of Naersk. When I open a shell, it pre-builds all my dependencies. The naersk docs show just throwing rustc and cargo into a mkShell but that isn't sufficient for the case I show below. Is there a way to ask naersk to stop prebuilding and just use buildPackage for my shell?
naersk-lib.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [
clang
cpiotools.defaultPackage.${system}
grub2_efi
jq
nix
pkgsStatic.pkg-config
pkgsStatic.stdenv.cc
qemu
rustfmt
which
vim # xxd
];
buildInputs = with pkgs; [ pkgsStatic.zstd cryptsetupStatic rustPlatform.bindgenHook ];
OVMF_PATH = pkgs.OVMF.fd;
# Configures the target which will be built.
# ref: https://doc.rust-lang.org/cargo/reference/config.html#buildtarget
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
# Enables static compilation.
#
# If the resulting executable is still considered dynamically
# linked by ldd but doesn't have anything actually linked to it,
# don't worry. It's still statically linked. It just has static
# position independent execution enabled.
# ref: https://github.com/rust-lang/rust/issues/79624#issuecomment-737415388
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
# Configures the linker which will be used. cc.targetPrefix is
# sometimes different than the targets used by rust. i.e.: the
# mingw-w64 linker is "x86_64-w64-mingw32-gcc" whereas the rust
# target is "x86_64-pc-windows-gnu".
#
# This is only necessary if rustc doesn't already know the correct linker to use.
#
# ref: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = with pkgs.pkgsStatic.stdenv;
"${cc}/bin/${cc.targetPrefix}gcc";
# link against libc.a
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS = "-lc";
doCheck = true;
};
| 14:40:02 |
jonringer | Not naersk, but I just rustPlatform.buildRustPackage + cargoLock.lockFile example | 21:25:39 |
jonringer | * Not naersk, but I just use rustPlatform.buildRustPackage + cargoLock.lockFile example | 21:26:26 |