Some checks failed
Ruff (Python code sniffer) / codesniffer-ruff (push) Has been cancelled
ShellCheck / codesniffer-shellcheck (push) Has been cancelled
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / codesniffer-shellcheck (push) Has been cancelled
Mark stable commit / codesniffer-ruff (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
* Rename `config.sh` to `bootstrap_config.sh` to clearly separate installer bootstrap config from Nix system config * Add `nix_conf_file.sh` to manage `/etc/nix/nix.conf` safely and idempotently * Ensure `nix-command` and `flakes` are enabled without overwriting existing experimental features * Invoke Nix config enforcement from `nix/init.sh` during root installation * Update documentation and ShellCheck annotations accordingly * Extend CLI git proxy to include `git status` https://chatgpt.com/share/693d5c4a-bad0-800f-adaf-4719dd4ca377
1.9 KiB
1.9 KiB
Nix Bootstrap (package-manager)
This directory contains the Nix initialization and bootstrap logic used by package-manager to ensure the nix command is available on supported systems (host machines and CI containers).
It is invoked during package installation (Arch/Debian/Fedora scriptlets) and can also be called manually.
Entry Point
- scripts/nix/init.sh
Main bootstrap script. It:- checks whether
nixis already available - adjusts
PATHfor common Nix locations - installs Nix when missing (daemon install on systemd hosts, single-user in containers)
- ensures predictable
nixavailability via symlinks (without overwriting distro-managed paths) - validates that
nixis usable at the end (CI-safe)
- checks whether
Library Layout
The entry point sources small, focused modules from scripts/nix/lib/:
- bootstrap_config.sh — configuration defaults (installer URL, retry timing)
- detect.sh — container detection helpers
- path.sh — PATH adjustments and
nixbinary resolution helpers - symlinks.sh — user/global symlink helpers for stable
nixdiscovery - users.sh — build group/users and container ownership/perms helpers
- install.sh — installer download + retry logic and execution helpers
Each library file includes a simple guard to prevent double-sourcing.
When It Runs
This bootstrap is typically executed automatically:
- Arch: post-install / post-upgrade hook
- Debian:
postinst - Fedora/RPM:
%post
Notes / Design Goals
- Cross-distro compatibility: supports common Linux layouts (including Arch placing
nixin /usr/sbin). - Non-destructive behavior: avoids overwriting distro-managed
nixbinaries. - CI robustness: retry logic for downloads and a final
nixavailability check. - Container-safe defaults: single-user install as a dedicated
nixuser when running as root in containers.