buildCommand expecting a set in installer/sd-card/sd-image.nix

I am trying to setup a NixOS configuration for an aarch64 host (specifically the Orange Pi 5B with an RK3588S) and want to create an SD card image based off of my configuration.

When importing the sd-image.nix module from nixpkgs and setting parameters:

imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix" ];

sdImage = {
	firmwarePartitionOffset = 16;
	firmwarePartitionName = "firmware";

(see .config/system/cerberus/image/default.nix at 79d83c156071f0fccc534d2bc5c98a481c52fdc4 · dskprt/.config · GitHub)

, then building an image with nix build
I get a “value is a function while a set was expected” on buildCommands in <nixpkgs>/nixos/modules/installer/sd-card/sd-image.nix
(nixpkgs/nixos/modules/installer/sd-card/sd-image.nix at b4df506a486a8ef2072129ec2cd44e548c041e4b · NixOS/nixpkgs · GitHub):

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nixos-sd-image-24.05.20240427.58a1abd-aarch64-linux.img'
         whose name attribute is located at /nix/store/801l7gvdz7yaibhjsxqx82sc7zkakjbq-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'nixos-sd-image-24.05.20240427.58a1abd-aarch64-linux.img'

         at /nix/store/801l7gvdz7yaibhjsxqx82sc7zkakjbq-source/nixos/modules/installer/sd-card/sd-image.nix:182:7:

          182|       buildCommand = ''
             |       ^
          183|         mkdir -p $out/nix-support $out/sd-image

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: value is a function while a set was expected

Is the SD installer currently broken or am I messing something up in my configuration?

turns out there was something wrong with how I was setting up the kernel package, nothing to do with sd-image like the traces showed

1 Like