nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
2 changed files with 19 additions and 12 deletions
Showing only changes of commit c7e2263d64 - Show all commits

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
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"
echo "Use binfmt QEMU!"
echo "https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU"
exit 1
fi
extra="--argstr system aarch64-linux"
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 \
-I nixos-config=${config}
nom-build '<nixpkgs/nixos>' -A vm \
-I nixos-config=${config}