Fix specialisation detection

I think
This commit is contained in:
Geoffrey Frogeye 2025-01-26 17:18:11 +01:00
parent 8fd6a0d2d8
commit 3335f90de4
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -40,17 +40,31 @@ sudo nom build "$derivation^*" --no-link "$@"
info "Showing diff"
nvd diff "$(readlink -f /nix/var/nix/profiles/system)" "$toplevel"
# Figure out specialisation
specialisationArgs=()
info "Figuring current specialisation"
systemLink=
currentSystem="$(readlink -f /run/current-system)"
while read -r specialisation
while read -r system
do
if [ "$(readlink -f "/nix/var/nix/profiles/system/specialisation/$specialisation")" = "$currentSystem" ]
if [ "$(readlink -f "$system")" = "$currentSystem" ]
then
systemLink="$system"
break
fi
done <<< "$(ls -d /nix/var/nix/profiles/system-*-link{,/specialisation/*})"
specialisationArgs=()
if [ -n "$systemLink" ]
then
specialisation=$(echo "$systemLink" | cut -d/ -f8)
if [ -n "$specialisation" ]
then
debug "Using specialisation: $specialisation"
specialisationArgs=("--specialisation" "$specialisation")
fi
done <<< "$(ls /nix/var/nix/profiles/system/specialisation)"
else
warning "Could not find link for $currentSystem, will switch to non-specialized system"
fi
# Apply
confirm="n"