PortValhalla/archiso/scripts/build.fish

25 lines
914 B
Fish
Executable file

#!/bin/env fish
begin
set -l dir (status dirname)
source "$dir/../../scripts/lib/config.fish"
source "$dir/../../scripts/lib/nix.fish"
set -l projectName archiso-valhalla
set -l overlayDir (mktemp -d)
set -l upperDir (mktemp -d)
set -l workDir (mktemp -d)
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$nixPkgsDir"
mkdir -p "$rootHome"
and fish "$(status dirname)/../../scripts/lib/copy-repo.fish" "$projectDir"
downloadNixPkgs
and sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$overlayDir",upperdir="$upperDir",workdir="$workDir" "$profileDir"
and sudo mount --mkdir --bind "$nixPkgsCache" "$nixDir"
and sudo mkarchiso $argv "$profileDir"
sudo umount "$nixDir"
and sudo umount "$profileDir"
end