How to use generic-extlinux-compatible in cross-compilation context?


I’m still messing with my BTRFS Pi project.

I’m tinkering on a build that is running from an Arch Linux x86 host, using a VM to create a custom aarch64 NixOS image installed on BTRFS.

I have many parts of this working, but currently I’m having trouble installing the extlinux boot loader.

After creating myimage.nix with pkgs = { system = "aarch64-linux" } (I realize this isn’t cross-compilation, I have a pkgs, pkgsArm, and pkgsCross I’m using for various parts), I thought I’d manually be able to call "${myimage.config.boot.loader.generic-extlinux-compatible.populateCmd}" in the VM, but I’m getting file exec errors (I think because the VM is being run within an x86_64 pkgs context).

Then I figured that these shell commands should be fine to run on x86 (since it’s mostly moving and coyping files), but I get

nix-repl> (import <nixpkgs/nixos/modules/system/boot/loader/generic-extlinux-compatible> { inherit pkgs config lib; }).config
error: attribute 'boot' missing

Is there a way for me to import this from an x86 host to be used in building an aarch64 VM?

Thanks in advance!

It seems like I can use config only as aarch64 and the rest as x86_64-linux in this way:

 populateCmd = (import (pkgs.path + "/nixos/modules/system/boot/loader/generic-extlinux-compatible")
        inherit pkgs;
        config = myimage.config;
        lib = pkgs.lib;

Hopefully that’s a reasonable way to go about things.

Hosted by Flying Circus.