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

24 lines
601 B
Bash
Raw Normal View History

2023-10-29 17:20:35 +01:00
#/usr/bin/env sh
2023-11-22 00:52:31 +01:00
# Build a disk image for testing on pindakaas via sd card
2023-11-22 01:51:48 +01:00
if ! command -v nom-build
then
exec nix-shell -p nix-output-monitor --run $0
fi
2023-10-29 17:20:35 +01:00
export NIXPKGS_ALLOW_UNFREE=1
2023-11-22 00:52:31 +01:00
extra=""
if [ "$(uname -m)" != "aarch64" ]
then
2023-11-22 01:51:48 +01:00
if [ ! -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
2023-11-22 00:52:31 +01:00
then
2023-11-22 01:51:48 +01:00
echo "Use binfmt QEMU!"
echo "https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU"
exit 1
2023-11-22 00:52:31 +01:00
fi
2023-11-22 01:51:48 +01:00
extra="--argstr system aarch64-linux"
2023-11-22 00:52:31 +01:00
fi
2023-11-22 01:51:48 +01:00
nom-build '<nixpkgs/nixos>' -A config.system.build.sdImage \
-I nixos-config=./pindakaas.nix $extra --show-trace