Hello nix community!
I am trying to follow an existing guide for installing nixOS onto an Oracle Cloud VM, which is written assuming the VM is x86_64 – however, in my case I am attempting to adapt the guide/approach for an ARM64 VM.
Link to the guide:
The general approach is to replace an initial Ubuntu install by booting a kexec
-based image and install nixOS from there.
My difficulty at the moment is replacing the config.system.build.kernel
(and config.system.build.netbootRamdisk
) in the following section with something that cross-compiles a kernel from an x86_64 Linux host to arm64:
kexec.nix
{ config, pkgs, ... }:
{
imports = [
# this will work only under qemu, uncomment next line for full image
# <nixpkgs/nixos/modules/installer/netboot/netboot-minimal.nix>
<nixpkgs/nixos/modules/installer/netboot/netboot.nix>
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
# stripped down version of https://github.com/cleverca22/nix-tests/tree/master/kexec
system.build = rec {
image = pkgs.runCommand "image" { buildInputs = [ pkgs.nukeReferences ]; } ''
mkdir $out
cp ${config.system.build.kernel}/bzImage $out/kernel
cp ${config.system.build.netbootRamdisk}/initrd $out/initrd
nuke-refs $out/kernel
'';
...
<omitted remaining contents of kexec.nix>
...
So far I added the following snippet to the top of the file, and replaced some of the occurences of “pkgs
” with “pkgs.crossSystem
”:
let pkgs = import <nixpkgs> {
crossSystem = {
config = "aarch64-unknown-linux-gnu";
};
};
in
<kexec.nix contents from the guide...>
Hopefully someone can suggest a way how to replace config
with something that is compatible with the cross-compile target!