Cache nixpkgs
locally
This commit is contained in:
parent
9844355048
commit
1697879c64
|
@ -1,13 +1,24 @@
|
|||
#!/bin/bash
|
||||
contextRoot="$(mktemp -d)";
|
||||
root="$contextRoot/airootfs";
|
||||
rootHome="$root/root";
|
||||
nixDir="$root/nix/var/nix/profiles/per-user/root/channels/nixpkgs";
|
||||
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";
|
||||
git clone https://github.com/NixOS/nixpkgs.git --depth=1 -b nixos-24.05 "$nixDir";
|
||||
rm -rf "$nixDir/.git";
|
||||
sudo mount --mkdir -t overlay overlay -o lowerdir=.:"$contextRoot" "$profileDir";
|
||||
|
||||
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";
|
||||
|
|
Loading…
Reference in a new issue