Skip to content

Instantly share code, notes, and snippets.

@ardumont
Last active November 11, 2019 08:58
Show Gist options
  • Save ardumont/5c40f992dd11d98e51707784365de094 to your computer and use it in GitHub Desktop.
Save ardumont/5c40f992dd11d98e51707784365de094 to your computer and use it in GitHub Desktop.
nixos: build rpi4 sd-image
# To build, use:
# For https://github.com/NixOS/nixpkgs/pull/68265: works (building image
# though)
# NIXPKGS_HOME=$HOME/repo/public/nixpkgs
# NIXPKGS_CONFIG=$HOME/repo/private/nixos/rpi4/sd-image-rpi4.nix
# NIX_PATH="nixpkgs=$NIXPKGS_HOME" \
# nix-build '<nixpkgs/nixos>' -I nixos-config=$NIXPKGS_CONFIG -A config.system.build.sdImage
# For: https://github.com/NixOS/nixpkgs/pull/70796: does not work with uboot yet
# NIXPKGS_HOME=$HOME/repo/public/nixpkgs
# NIXPKGS_CONFIG=$NIXPKGS_HOME/nixos/modules/installer/cd-dvd/sd-image-raspberrypi4.nix
# NIX_PATH="nixpkgs=$NIXPKGS_HOME" \
# nix-build '<nixpkgs/nixos>' -I nixos-config=$NIXPKGS_CONFIG -A config.system.build.sdImage
{ pkgs, ... }: {
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
];
sdImage = {
firmwareSize = 128; # firmware partition big enough
};
boot = {
kernelPackages = pkgs.linuxPackages_rpi4;
loader = {
raspberryPi = {
enable = true;
version = 4;
uboot.enable = true;
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment