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 # 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 export NIXPKGS_ALLOW_UNFREE=1
extra="" extra=""
if [ "$(uname -m)" != "aarch64" ] if [ "$(uname -m)" != "aarch64" ]
then then
# If we have binfmt QEMU (https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU), if [ ! -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
# we can pretend we're aarch64.
if [ -f /proc/sys/fs/binfmt_misc/qemu-aarch64 ]
then then
extra="--argstr system aarch64-linux" echo "Use binfmt QEMU!"
# Otherwise, use cross-compilation... echo "https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU"
# theorically faster but doesn't use the cache and never got it to build a full customized image exit 1
else
extra="--argstr nixpkgs.crossSystem.system aarch64-linux"
fi fi
extra="--argstr 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 x86_64 hosts: use curacao config
# For aarch64 hosts: use pindakaas 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 export NIXPKGS_ALLOW_UNFREE=1
if [ "$(uname -m)" == "x86_64" ] if [ "$(uname -m)" == "x86_64" ]
then then
@ -13,6 +18,5 @@ elif [ "$(uname -m)" == "aarch64" ]
then then
config=./pindakaas.nix config=./pindakaas.nix
fi fi
nix-build '<nixpkgs/nixos>' -A vm \ nom-build '<nixpkgs/nixos>' -A vm \
-I nixpkgs=channel:nixos-23.05 \ -I nixos-config=${config}
-I nixos-config=${config}