Created
July 18, 2023 20:00
-
-
Save Roger/076da327c375e5cb4cc9d63f5507e6bc to your computer and use it in GitHub Desktop.
Flake to build nixos for raspberrypi 2 armv7l
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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