# empty nix based chroot... install variant function inst_create_dir() { mkdir -p /cachy } function inst_mount() { if findmnt /cachy/nix; then return fi mkdir -p /cachy/nix mkdir -p /cachy/proc mkdir -p /cachy/sys mkdir -p /cachy/out mkdir -p /cachy/dev mount -o bind /nix /cachy/nix mount -o bind /proc /cachy/proc mount -o bind /sys /cachy/sys mount -o bind /dev /cachy/dev mount -o bind / /cachy/out } function inst_enter() { NIX=$(realpath $(which nix)) SHELL=$(realpath $(which bash)) CHROOT=$(which chroot) ENV=$(dirname $(realpath $(which env)))/env PATH=$(nix eval --impure --raw --expr 'let pkgs = import {}; in with pkgs; lib.makeBinPath [ vim nix pacman busybox curl bash gawk ]') echo -en 'source /to-source; echo hooooooo; rm /rcfile' > /cachy/rcfile $CHROOT /cachy $ENV -i PATH="$PATH" $SHELL --rcfile /rcfile # export SSL_CERT_FILE=/out/etc/static/ssl/certs/ca-certificates.crt mkdir -p /etc echo "nameserver 1.1.1.1" > /etc/resolv.conf } function inst_setup() { curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz tar -xf cachyos-repo.tar.xz touch /etc/pacman.conf pacman-key --init mkdir -p /var/lib/pacman bash ./cachyos-repo/cachyos-repo.sh mkdir -p /lib ln -fs $(nix eval --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#glibc.out --raw)/lib64/ld-linux-x86-64.so.2 /lib/ld-linux-x86-64.so.2 }