Behind a TLS intercepting proxy, I am unable to build Nix packages using rustPlatform.buildRustPackage
because cargo must be configured with the path to the SSL certificates. This config file is usually located in $HOME/.cargo/config
, but since $HOME
is intentionally useless in the build environment, this config file will not be found by cargo. How can I configure cargo in buildRustPackage
, or make a config file available? I am not using HomeManager, and would ideally like to configure this system-wide on NixOS at least.
Technically, you can put config.toml
in the same directory as the package and then pass it to cargo like so:
let
configFile = ./config.toml;
in
buildRustPackage {
cargoBuildFlags = [
"--config"
configFile
];
}
Don’t know how well this works, though.
Alternatively, it seems you can set this using the CARGO_HTTP_CAINFO
env variable according to the - Environment Variables - The Cargo Book
1 Like