Skip to content

Instantly share code, notes, and snippets.

@gnull
Created January 7, 2026 15:26
Show Gist options
  • Select an option

  • Save gnull/fdb9f4f6e05c80f904bb98dbb169a700 to your computer and use it in GitHub Desktop.

Select an option

Save gnull/fdb9f4f6e05c80f904bb98dbb169a700 to your computer and use it in GitHub Desktop.
Nix flake to reproduce bad bootable flag in sd-image.nix
{
description = "NixOS configuration for an SD card image";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# nixpkgs.url = "github:gnull/nixpkgs/patch-1";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self, nixpkgs, flake-utils, ... }:
{
## System config, use with nixos-rebuild
nixosConfigurations = {
orangepi5plus = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image.nix"
({config, lib, ...}: {
boot = {
loader = {
grub.enable = lib.mkForce false;
generic-extlinux-compatible.enable = lib.mkForce true;
};
};
sdImage = {
populateFirmwareCommands = "";
firmwarePartitionOffset = 32;
firmwarePartitionName = "BOOT";
firmwareSize = 200; # MiB
populateRootCommands = "";
};
})
];
specialArgs = {
inherit nixpkgs;
};
};
};
} // flake-utils.lib.eachDefaultSystem (system:
{
packages = {
sdImage = self.nixosConfigurations.orangepi5plus.config.system.build.sdImage;
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment