Skip to content

Instantly share code, notes, and snippets.

@shiryel
Created August 22, 2024 00:55
Show Gist options
  • Save shiryel/4561b6b65972c192270179d5fc415819 to your computer and use it in GitHub Desktop.
Save shiryel/4561b6b65972c192270179d5fc415819 to your computer and use it in GitHub Desktop.
How to cross-compile with a custom stdenv on Nix
{
outputs = { nixpkgs, ... }: {
pkgsWeb = import nixpkgs {
system = "x86_64-linux";
# NOTE: enabling setting crossSystem disables config.replaceStdenv
crossSystem = {
config = "wasm32-unknown-none";
rust.rustcTarget = "wasm32-unknown-unknown";
useLLVM = true;
};
# see: nixpkgs/pkgs/stdenv/cross/default.nix
config.replaceCrossStdenv = { buildPackages, baseStdenv }: baseStdenv // { cc = buildPackages.llvmPackages_19.clang; };
config.allowUnsupportedSystem = true;
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment