Skip to content

Instantly share code, notes, and snippets.

@Roger
Created July 18, 2023 20:00
Show Gist options
  • Save Roger/076da327c375e5cb4cc9d63f5507e6bc to your computer and use it in GitHub Desktop.
Save Roger/076da327c375e5cb4cc9d63f5507e6bc to your computer and use it in GitHub Desktop.
Flake to build nixos for raspberrypi 2 armv7l
{
inputs.nixpkgs.url = "nixpkgs/nixos-23.05";
outputs = { self, nixpkgs }:
let rpiOverlays = [
(final: super: {
# Allow missing modules because the master module list is based on strings and the rpi kernel
# is missing some
# https://github.com/NixOS/nixpkgs/issues/154163
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
})
];
rpi2pkgs = import nixpkgs {
overlays = rpiOverlays;
system = "x86_64-linux";
crossSystem.system = "armv7l-linux";
};
in rec {
nixosConfigurations = {
rpi2 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
pkgs = rpi2pkgs;
modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-armv7l-multiplatform.nix"
{
system.stateVersion = "23.05";
boot.kernelPackages = nixpkgs.lib.mkForce rpi2pkgs.linuxPackages_rpi2;
}
];
};
images.rpi2 = nixosConfigurations.rpi2.config.system.build.sdImage;
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment