From 026237a5f47986aa644761445ff71f6c1f0f6f90 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 20 May 2026 13:56:10 +0100 Subject: fix(bootstrap): use pacman nix instead of curl installer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pacman's 'nix' package is already in meta/base.txt and provides the same multi-user daemon setup (nix-daemon.socket already enabled via systemd-units/system.txt; flakes already enabled via /etc/nix/nix.conf from etc/). The curl-piped Determinate installer was adding nothing on top — and on a host where pacman already installed nix, it would create two competing nix binaries. Changes: - Add 'nix' to PREREQS so pacman installs it alongside the other prerequisites, before 'just init' runs. - Drop the curl install block. - Source /etc/profile.d/nix.sh (or nix-daemon.sh) before 'just init' so the nix-switch step inside 'just init' finds the binary in PATH. --- bootstrap.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 1d3783b..d6f986c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -33,7 +33,7 @@ id -nG "$USER" | tr ' ' '\n' | grep -qx wheel || # 2. install sudo + pacman prerequisites, enable wheel in sudoers. # If sudo is absent we do this in a single su -c so the root password # is entered only once. If sudo is already there, reuse it. -PREREQS='sudo git base-devel chezmoi just efibootmgr' +PREREQS='sudo git base-devel chezmoi just efibootmgr nix' SUDOERS_SED='s/^# *\(%wheel ALL=(ALL:ALL\(:ALL\)*) ALL\)/\1/' if ! command -v sudo >/dev/null 2>&1; then @@ -72,25 +72,24 @@ fi # at sudo-rs (PATH precedence shadows /usr/bin/sudo), and installs # git hooks. The classic 'sudo' package stays installed because # base-devel hard-depends on it; that's harmless — the binary is -# never invoked once /usr/local/bin/sudo is in place. -# `just init` also runs `just nix-switch` (step 5b below); the nix -# install needs to happen before that. +# never invoked once /usr/local/bin/sudo is in place. `just init` +# also runs `just nix-switch` to apply the Home-Manager profile; +# nix itself is part of PREREQS above (pacman package), and +# nix-daemon.socket is enabled by `unit-apply` via +# systemd-units/system.txt. cd "$DOTFILES_DIR" -# 5a. install nix (Determinate Systems installer, multi-user) before -# `just init`, so `just nix-switch` finds it. -if ! command -v nix >/dev/null 2>&1; then - log 'installing nix (Determinate Systems multi-user installer)' - curl --proto '=https' --tlsv1.2 -sSf -L \ - https://install.determinate.systems/nix | - sh -s -- install linux --no-confirm - # Source nix env for the rest of this script (installer writes - # /etc/profile.d/nix.sh but the current shell hasn't sourced it). - if [ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]; then - # shellcheck disable=SC1091 - . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh +# Source the nix profile so `nix` is on PATH for the rest of this +# script (pacman drops /etc/profile.d/nix.sh but the current shell +# didn't read it). Multi-user (daemon mode) and per-user variants exist; +# pacman ships the multi-user one. +for f in /etc/profile.d/nix.sh /etc/profile.d/nix-daemon.sh; do + if [ -r "$f" ]; then + # shellcheck disable=SC1090 + . "$f" + break fi -fi +done log 'running just init' just init -- cgit v1.3.1