deinonyxus/files/scripts/install-nix.sh

21 lines
735 B
Bash
Raw Normal View History

2025-12-22 21:13:22 +02:00
#!/usr/bin/env bash
set -euo pipefail
rpm_url="https://nix-community.github.io/nix-installers/nix/x86_64/nix-multi-user-2.24.10.rpm"
install -d /usr/share/nix-store /var/lib/nix-store /var/cache/nix-store /nix
2025-12-22 21:56:28 +02:00
# Avoid systemd calls during RPM %post in the image build environment.
export SYSTEMD_OFFLINE=1
# Install the RPM; allow missing GPG key since we fetch directly by URL.
dnf install -y --nogpgcheck "$rpm_url"
2025-12-22 21:13:22 +02:00
# Move the pre-populated store out of /nix so it can serve as the immutable lowerdir.
if compgen -G "/nix/*" >/dev/null; then
mv /nix/* /usr/share/nix-store/
fi
2025-12-22 21:56:28 +02:00
# The RPM %post handles sysusers/tmpfiles; if we ran with SYSTEMD_OFFLINE the
# post scripts are still executed, so no extra calls are needed here.