32 lines
1 KiB
Bash
Executable file
32 lines
1 KiB
Bash
Executable file
#!/bin/bash
|
|
overlayDir="$(mktemp -d)";
|
|
upperDir="$(mktemp -d)";
|
|
workDir="$(mktemp -d)";
|
|
cacheRoot=~/.cache/archiso-valhalla;
|
|
nixCache="$cacheRoot/nixpkgs";
|
|
root="airootfs";
|
|
rootHome="$overlayDir/$root/root";
|
|
profileDir="/mnt/archiso-valhalla";
|
|
projectDir="$rootHome/PortValhalla";
|
|
nixDir="$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs";
|
|
mkdir -p "$rootHome";
|
|
git clone .. "$projectDir";
|
|
git -C .. diff HEAD | git -C "$projectDir" apply --allow-empty;
|
|
|
|
git -C .. ls-files --exclude-standard --others | \
|
|
while read file; do
|
|
cp "../$file" "$projectDir/$file";
|
|
done;
|
|
|
|
if [ ! -d "$nixCache" ]; then
|
|
mkdir -p "$nixCache"
|
|
git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b nixos-24.05 "$nixCache";
|
|
rm -rf "$nixCache/.git";
|
|
fi;
|
|
|
|
sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir";
|
|
sudo mount --mkdir --bind "$nixCache" "$nixDir";
|
|
sudo mkarchiso "$@" "$profileDir";
|
|
sudo umount "$nixDir";
|
|
sudo umount "$profileDir";
|