I need help with an error: genericBuild: command not found

I’m trying to use a flake to build an sd card image for a raspberry pi:

flake.nix

{
  description = "";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixos-hardware.url = "github:NixOS/nixos-hardware/master";
  };

  outputs =
    {
      self,
      nixpkgs,
      nixos-generators,
      nixos-hardware,
      ...
    }@inputs:
    rec {

      packages.x86_64-linux = {
        rpi = nixos-generators.nixosGenerate {
          system = "aarch64-linux";
          format = "sd-aarch64";
          modules = [
            ./configuration.nix
            nixos-hardware.nixosModules.raspberry-pi-4
          ];
        };
      };
    };
}

This is the error I’m getting:

$ nix build .#rpi
warning: Git tree '/home/azani/projects/nixos_homelab' is dirty
error: builder for '/nix/store/m4qvgmwaklkv9g2h9y0g1v438j3w4q7z-config.txt.drv' failed with exit code 127;
       last 1 log lines:
       > /nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh: line 1: genericBuild: command not found
       For full logs, run:
         nix log /nix/store/m4qvgmwaklkv9g2h9y0g1v438j3w4q7z-config.txt.drv
error: builder for '/nix/store/w9x9b9rfvzkj5si177p456ah5w4qiyha-install-extlinux-conf.sh.drv' failed with exit code 127;
       last 1 log lines:
       > /nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh: line 1: genericBuild: command not found
       For full logs, run:
         nix log /nix/store/w9x9b9rfvzkj5si177p456ah5w4qiyha-install-extlinux-conf.sh.drv
error: builder for '/nix/store/q7dwh3jin9id830nvhrmgz6lzgjv89r0-stage-2-init.sh.drv' failed with exit code 127;
       last 1 log lines:
       > /nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh: line 1: genericBuild: command not found
       For full logs, run:
         nix log /nix/store/q7dwh3jin9id830nvhrmgz6lzgjv89r0-stage-2-init.sh.drv
error: builder for '/nix/store/n0h28zsqzckhyzqb9137jf7rkd56l735-users-groups.json.drv' failed with exit code 127;
       last 1 log lines:
       > /nix/store/shkw4qm9qcw5sc5n1k5jznc83ny02r39-default-builder.sh: line 1: genericBuild: command not found
       For full logs, run:
         nix log /nix/store/n0h28zsqzckhyzqb9137jf7rkd56l735-users-groups.json.drv
error: 1 dependencies of derivation '/nix/store/72bwa8iylfvvc44ilixgk7m56zh80v8h-nixos-image-sd-card-25.11.20250913.c23193b-aarch64-linux.img.zst.drv' failed to build

I’d love some help figuring out what is wrong. The flake works fine on my desktop but not on my laptop. I’m confused how that can happen.

I am confused by the error messages, though my first check was to see if binfmt is set up correctly on the host that fails the build.

1 Like

How would I check that?

By looking at your config of the host where it works and where it not works, and comparing them, especially the binfmt config.

Also, a shallow check, if nix run --system aarch64-linux nixpkgs#hello does print anything but hello, world its not set up correctly

1 Like