Created
August 22, 2024 00:55
-
-
Save shiryel/4561b6b65972c192270179d5fc415819 to your computer and use it in GitHub Desktop.
How to cross-compile with a custom stdenv on Nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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