2024-07-07 22:44:35 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
begin
|
2024-11-01 12:12:16 +00:00
|
|
|
source "$(status dirname)/../../scripts/lib/config.fish"
|
2024-07-07 22:44:35 +00:00
|
|
|
set -l projectName archiso-valhalla
|
|
|
|
set -l overlayDir (mktemp -d)
|
|
|
|
set -l upperDir (mktemp -d)
|
|
|
|
set -l workDir (mktemp -d)
|
|
|
|
set -l cacheRoot ~/".cache/$projectName"
|
|
|
|
set -l nixCache "$cacheRoot/nixpkgs/$nixVersion"
|
|
|
|
set -l root airootfs
|
|
|
|
set -l rootHome "$overlayDir/$root/root"
|
|
|
|
set -l profileDir "/mnt/$projectName"
|
|
|
|
set -l projectDir "$rootHome/PortValhalla"
|
|
|
|
set -l nixDir "$profileDir/$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs"
|
|
|
|
|
|
|
|
mkdir -p "$rootHome"
|
2024-11-01 12:12:16 +00:00
|
|
|
and fish "$(status dirname)/../../scripts/lib/copy-repo.fish" "$projectDir"
|
2024-07-07 22:44:35 +00:00
|
|
|
|
2024-07-07 23:03:21 +00:00
|
|
|
and begin
|
|
|
|
if [ ! -d "$nixCache" ]
|
|
|
|
mkdir -p "$nixCache"
|
|
|
|
and git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b "$nixVersion" "$nixCache"
|
|
|
|
and rm -rf "$nixCache/.git"
|
|
|
|
end
|
2024-07-07 22:44:35 +00:00
|
|
|
end
|
|
|
|
|
2024-07-07 23:03:21 +00:00
|
|
|
and sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir"
|
|
|
|
and sudo mount --mkdir --bind "$nixCache" "$nixDir"
|
|
|
|
and sudo mkarchiso $argv "$profileDir"
|
2024-07-07 22:57:44 +00:00
|
|
|
sudo umount "$nixDir"
|
2024-07-07 23:03:21 +00:00
|
|
|
and sudo umount "$profileDir"
|
2024-07-07 22:44:35 +00:00
|
|
|
end
|