nix: nom nom 😋

This commit is contained in:
Geoffrey Frogeye 2023-11-22 01:51:48 +01:00
parent 5125e05266
commit c7e2263d64
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
2 changed files with 19 additions and 12 deletions

View file

@ -2,19 +2,22 @@
# Build a disk image for testing on pindakaas via sd card
if ! command -v nom-build
then
exec nix-shell -p nix-output-monitor --run $0
fi
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 ]
if [ ! -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
then
echo "Use binfmt QEMU!"
echo "https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU"
exit 1
fi
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
nom-build '<nixpkgs/nixos>' -A config.system.build.sdImage \
-I nixos-config=./pindakaas.nix $extra --show-trace

View file

@ -5,6 +5,11 @@
# For x86_64 hosts: use curacao config
# For aarch64 hosts: use pindakaas config
if ! command -v nom-build
then
exec nix-shell -p nix-output-monitor --run $0
fi
export NIXPKGS_ALLOW_UNFREE=1
if [ "$(uname -m)" == "x86_64" ]
then
@ -13,6 +18,5 @@ elif [ "$(uname -m)" == "aarch64" ]
then
config=./pindakaas.nix
fi
nix-build '<nixpkgs/nixos>' -A vm \
-I nixpkgs=channel:nixos-23.05 \
nom-build '<nixpkgs/nixos>' -A vm \
-I nixos-config=${config}