Hello everyone, I’m trying to create an SD card for a raspberry 3b+ from a macbook x86_64-darwin
.
My attempts have been a total failure so far.
I’ve been trying to use nixos-generators but it doesn’t seem to work. I have something like this:
/**
nix build .#rpi
*/
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-generators, ... }: {
packages.aarch64-linux = {
rpi = nixos-generators.nixosGenerate {
system = "aarch64-linux";
modules = [
# you can include your own nixos configuration here, i.e.
# ./configuration.nix
{
config = {
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
networking.hostName = "woile-1";
system = {
stateVersion = "22.11";
# Disable zstd compression
# build.sdImage.compressImage = false;
};
users.users.root = {
openssh.authorizedKeys.keys = [
"ssh-rsa ... "
];
};
};
}
];
format = "sd-aarch64";
};
# vbox = nixos-generators.nixosGenerate {
# system = "aarch64-linux";
# format = "virtualbox";
# };
};
};
}
And when running nix build .#rpi
I get this error:
error: flake 'git+file:///REDACTED/home-cluster?dir=images' does not provide attribute 'packages.x86_64-darwin.rpi', 'legacyPackages.x86_64-darwin.rpi' or 'rpi'
When I change packages.aarch64-linux
to packages.x86_64-darwin
I get the following error:
error: flake 'git+file:///REDACTED/home-cluster?dir=images' does not provide attribute 'packages.x86_64-darwin.rpi', 'legacyPackages.x86_64-darwin.rpi' or 'rpi'
If I run the build like this: nix build --option system aarch64-linux --option sandbox false .#rpi
I get another error:
error: 1 dependencies of derivation '/nix/store/g0rc1vxk4qadgd0dxfr0csp16ywag6b1-nixos-sd-image-23.05.20230113.befc839-aarch64-linux.img.drv' failed to build
And the logs:
bash: /nix/store/m45cjiwspshg01wrk2pln2qndasky23r-bash-5.1-p16/bin/bash: cannot execute binary file
Any idea or tips? Ideally I would like to tell the flake to use something like qemu or a vm, but it’s really hard.
Thanks!