Failing to use NixOS on ARM by compiling through QEMU

I want to use a remote builder for my phone (aarch64-linux)

As I have a non-NixOS machine I tried to set up a vm with the binfmt wrapper enabled in its configuration.nix.

configuration.nix (vm-config.nix)
let
  qemuOverlay = (import ./overlays/qemu);
in
{
  imports = [
    ./qemu.nix
  ];

  config = {
    boot.kernelModules = [ "kvm-intel" ];

    qemu-user.arm = true;
    boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

    nix = {
      trustedUsers = [ "573" "builder" ];
    };

    users.users.builder = {
      createHome = true;
      isNormalUser = true;
    };
  };
}
vm.nix
{ config, lib, pkgs, ... }:

with lib;

{
  imports =
    [ <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
      ./vm-config.nix
    ];

  system.build.qemuvmImage = import <nixpkgs/nixos/lib/make-disk-image.nix> {
    inherit lib config;
    pkgs = import <nixpkgs/nixos> { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
    diskSize = 8192;
    format = "qcow2";
    configFile = pkgs.writeText "configuration.nix"
      ''
        {
          imports = [ <./machine-config.nix> ];
        }
      '';
    };
}

In the same folder I have both qemu.nix and the overlay structure.

When I run $ nix-build '<nixpkgs/nixos>' -A vm -I nixos-config=vm.nix it gives me

error: attribute ‘qemu-user-arm’ missing, at /home/573/remote-builder-nix/qemu.nix:11:22
though.

What am I missing here ?

In the configuration.nix listed above one could use qemu-user.aarch64 = true; instead of qemu-user.arm = true;

Reasons:

  1. https://github.com/bqv/nixrc/blob/b613694dece8bf2e4df6c28ed9861c9dc27fc166/profiles/misc/qemu.nix#L24
    and
  2. https://github.com/bqv/nixrc/blob/b613694dece8bf2e4df6c28ed9861c9dc27fc166/profiles/misc/qemu.nix#L38

Consider this topic closed in this thread.