dotfiles/config/nix/build-pindakaas-image.sh

21 lines
736 B
Bash
Executable file

#/usr/bin/env sh
# Build a disk image for testing on pindakaas via sd card
export NIXPKGS_ALLOW_UNFREE=1
extra=""
if [ "$(uname -m)" != "aarch64" ]
then
# If we have binfmt QEMU (https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU),
# we can pretend we're aarch64.
if [ -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
then
extra="--argstr system aarch64-linux"
# Otherwise, use cross-compilation...
# theorically faster but doesn't use the cache and never got it to build a full customized image
else
extra="--argstr nixpkgs.crossSystem.system aarch64-linux"
fi
fi
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./pindakaas.nix $extra --show-trace