mirror of
https://github.com/bin456789/reinstall.git
synced 2026-05-21 05:27:41 +08:00
Compare commits
2 Commits
9e71f131db
...
8d099f167f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d099f167f | |||
| 37af3fcd5f |
@ -4194,7 +4194,7 @@ recreate_grub_or_extlinux_cfg() {
|
|||||||
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||||
# 手动启用 41_custom
|
# 手动启用 41_custom
|
||||||
nixos_grub_home="$(dirname "$(readlink -f "$(get_cmd_path grub-mkconfig)")")/.."
|
nixos_grub_home="$(dirname "$(readlink -f "$(get_cmd_path grub-mkconfig)")")/.."
|
||||||
$nixos_grub_home/etc/grub.d/41_custom >>$target_cfg
|
$nixos_grub_home/etc/grub.d/41_custom >>"$(dirname "$target_cfg")/grub.cfg"
|
||||||
elif is_have_cmd update-grub; then
|
elif is_have_cmd update-grub; then
|
||||||
update-grub
|
update-grub
|
||||||
else
|
else
|
||||||
|
|||||||
20
trans.sh
20
trans.sh
@ -1682,6 +1682,21 @@ install_nixos() {
|
|||||||
export USER=root
|
export USER=root
|
||||||
export HOME=/root
|
export HOME=/root
|
||||||
|
|
||||||
|
configure_nix_substituters() {
|
||||||
|
if ! is_in_china; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
nix_conf=/etc/nix/nix.conf
|
||||||
|
mkdir -p "$(dirname "$nix_conf")"
|
||||||
|
|
||||||
|
if [ -f "$nix_conf" ]; then
|
||||||
|
sed -i '/^[[:space:]]*substituters[[:space:]]*=/d' "$nix_conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "substituters = $mirror/store" >>"$nix_conf"
|
||||||
|
}
|
||||||
|
|
||||||
case "$nix_from" in
|
case "$nix_from" in
|
||||||
alpine)
|
alpine)
|
||||||
apk add nix
|
apk add nix
|
||||||
@ -1690,9 +1705,7 @@ install_nixos() {
|
|||||||
# https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/nix/APKBUILD#L125
|
# https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/nix/APKBUILD#L125
|
||||||
sed -i '/max-jobs/d' /etc/nix/nix.conf
|
sed -i '/max-jobs/d' /etc/nix/nix.conf
|
||||||
echo "max-jobs = $threads" >>/etc/nix/nix.conf
|
echo "max-jobs = $threads" >>/etc/nix/nix.conf
|
||||||
if is_in_china; then
|
configure_nix_substituters
|
||||||
echo "substituters = $mirror/store" >>/etc/nix/nix.conf
|
|
||||||
fi
|
|
||||||
rc-service -q nix-daemon restart
|
rc-service -q nix-daemon restart
|
||||||
# 添加 nix-env 安装的软件到 PATH
|
# 添加 nix-env 安装的软件到 PATH
|
||||||
PATH="/root/.nix-profile/bin:$PATH"
|
PATH="/root/.nix-profile/bin:$PATH"
|
||||||
@ -1743,6 +1756,7 @@ install_nixos() {
|
|||||||
apk del xz
|
apk del xz
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. /root/.nix-profile/etc/profile.d/nix.sh
|
. /root/.nix-profile/etc/profile.d/nix.sh
|
||||||
|
configure_nix_substituters
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user