fixed missing system profile

This commit is contained in:
randogoth 2026-01-14 18:46:55 +02:00
parent c2eb4e0bf6
commit 8e33e4fa3f

View file

@ -14,11 +14,25 @@ copy_seed_store() {
fi fi
} }
ensure_system_profile() {
local seed_profile="/usr/share/nix-store/var/nix/profiles/system"
local target_profile="/var/lib/nix-store/var/nix/profiles/system"
mkdir -p /var/lib/nix-store/var/nix/profiles
if { [ ! -e "$target_profile" ] || [ -L "$target_profile" ] && [ ! -e "$(readlink -f "$target_profile")" ]; } \
&& [ -e "$seed_profile" ]; then
cp -a "$seed_profile" "$target_profile"
fi
}
if ! mountpoint -q /nix; then if ! mountpoint -q /nix; then
if [ -z "$(ls -A /var/lib/nix-store 2>/dev/null)" ] && compgen -G "/usr/share/nix-store/*" >/dev/null; then if [ -z "$(ls -A /var/lib/nix-store 2>/dev/null)" ] && compgen -G "/usr/share/nix-store/*" >/dev/null; then
copy_seed_store copy_seed_store
fi fi
ensure_system_profile
mount --bind /var/lib/nix-store /nix mount --bind /var/lib/nix-store /nix
mount -o remount,bind,exec /nix mount -o remount,bind,exec /nix