Cross compile linux from external source for riscv64

I am new to Nix. I want to compile Linux from external source (hosted on github) for riscv64. I am using ubuntu on x86_64 machine. Can any one point me to some reference code how cross compilation works? Whatever tutorial I have found, they explain cross compilation of linux versions available with nixpkgs.
Thanks.

Have a look at this repo: GitHub - zhaofengli/nixos-riscv64: NixOS on the HiFive Unmatched and especially for building a Kernel hosted in some git repo: nixos-riscv64/default.nix at def02c67833bf551288c5cbd8ed6652b255d2fe8 · zhaofengli/nixos-riscv64 · GitHub

1 Like

@matthewcroughan had a project with this

1 Like

My visionfive-nix project accomplishes most of this, if you have any other questions feel free to ask after you’ve taken a look

1 Like