25 lines
819 B
Bash
Executable file
25 lines
819 B
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";
|
|
nixDir="$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs";
|
|
mkdir -p "$rootHome";
|
|
git clone .. "$rootHome/PortValhalla";
|
|
|
|
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";
|