Fix specialisation detection
I think
This commit is contained in:
parent
8fd6a0d2d8
commit
3335f90de4
1 changed files with 20 additions and 6 deletions
|
@ -40,17 +40,31 @@ sudo nom build "$derivation^*" --no-link "$@"
|
||||||
info "Showing diff"
|
info "Showing diff"
|
||||||
nvd diff "$(readlink -f /nix/var/nix/profiles/system)" "$toplevel"
|
nvd diff "$(readlink -f /nix/var/nix/profiles/system)" "$toplevel"
|
||||||
|
|
||||||
# Figure out specialisation
|
info "Figuring current specialisation"
|
||||||
specialisationArgs=()
|
systemLink=
|
||||||
currentSystem="$(readlink -f /run/current-system)"
|
currentSystem="$(readlink -f /run/current-system)"
|
||||||
while read -r specialisation
|
while read -r system
|
||||||
do
|
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
|
then
|
||||||
debug "Using specialisation: $specialisation"
|
|
||||||
specialisationArgs=("--specialisation" "$specialisation")
|
specialisationArgs=("--specialisation" "$specialisation")
|
||||||
fi
|
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
|
# Apply
|
||||||
confirm="n"
|
confirm="n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue