diff --git a/ChangeMirrors.sh b/ChangeMirrors.sh index 2266bc05..d0153246 100755 --- a/ChangeMirrors.sh +++ b/ChangeMirrors.sh @@ -1,6 +1,6 @@ #!/bin/bash ## Author: SuperManito -## Modified: 2025-01-22 +## Modified: 2025-02-20 ## License: MIT ## GitHub: https://github.com/SuperManito/LinuxMirrors ## Website: https://linuxmirrors.cn @@ -176,6 +176,7 @@ SYSTEM_OPENSUSE="openSUSE" SYSTEM_ARCH="Arch" SYSTEM_ALPINE="Alpine" SYSTEM_GENTOO="Gentoo" +SYSTEM_NIXOS="NixOS" ## 定义系统版本文件 File_LinuxRelease=/etc/os-release @@ -213,6 +214,8 @@ File_GentooMakeConf=/etc/portage/make.conf File_GentooMakeConfBackup=/etc/portage/make.conf.bak File_GentooReposConf=/etc/portage/repos.conf/gentoo.conf File_GentooReposConfBackup=/etc/portage/repos.conf/gentoo.conf.bak +File_NixConf=/etc/nix/nix.conf +File_NixConfBackup=/etc/nix/nix.conf.bak Dir_GentooReposConf=/etc/portage/repos.conf Dir_DebianExtendSource=/etc/apt/sources.list.d Dir_DebianExtendSourceBackup=/etc/apt/sources.list.d.bak @@ -220,6 +223,7 @@ Dir_YumRepos=/etc/yum.repos.d Dir_YumReposBackup=/etc/yum.repos.d.bak Dir_ZYppRepos=/etc/zypp/repos.d Dir_ZYppReposBackup=/etc/zypp/repos.d.bak +Dir_NixConfig=/etc/nix ## 定义颜色变量 RED='\033[31m' @@ -660,6 +664,8 @@ function collect_system_info() { SYSTEM_FACTIONS="${SYSTEM_GENTOO}" elif [[ "${SYSTEM_NAME}" == *"openSUSE"* ]]; then SYSTEM_FACTIONS="${SYSTEM_OPENSUSE}" + elif [[ "${SYSTEM_NAME}" == *"NixOS"* ]]; then + SYSTEM_FACTIONS="${SYSTEM_NIXOS}" else output_error "当前操作系统不在本脚本的支持范围内,请前往官网查看支持列表!" fi @@ -753,7 +759,7 @@ function collect_system_info() { ;; esac ;; - "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_OPENKYLIN}") + "${SYSTEM_KALI}" | "${SYSTEM_DEEPIN}" | "${SYSTEM_ZORIN}" | "${SYSTEM_ARCH}" | "${SYSTEM_ALPINE}" | "${SYSTEM_GENTOO}" | "${SYSTEM_OPENKYLIN}" | "${SYSTEM_NIXOS}") # 理论全部支持或不作判断 ;; *) @@ -860,6 +866,9 @@ function collect_system_info() { SOURCE_BRANCH="${SOURCE_BRANCH// /-}" fi ;; + "${SYSTEM_NIXOS}") + SOURCE_BRANCH="nix-channels" + ;; esac fi ## 定义软件源更新文字 @@ -876,6 +885,9 @@ function collect_system_info() { "${SYSTEM_ARCH}" | "${SYSTEM_GENTOO}") SYNC_MIRROR_TEXT="同步软件源" ;; + "${SYSTEM_NIXOS}") + SYNC_MIRROR_TEXT="更新二进制缓存与频道源" + ;; esac ## 判断是否可以使用高级交互式选择器 CAN_USE_ADVANCED_INTERACTIVE_SELECTION="false" @@ -1326,6 +1338,11 @@ function backup_original_mirrors() { [ -d "${Dir_GentooReposConf}" ] || mkdir -p "${Dir_GentooReposConf}" backup_file $File_GentooReposConf $File_GentooReposConfBackup "gentoo.conf" ;; + "${SYSTEM_NIXOS}") + [ ! -d $Dir_NixConfig ] && mkdir -p $Dir_NixConfig + # /etc/nix/nix.conf + backup_file $File_NixConf $File_NixConfBackup "nix.conf" + ;; esac fi } @@ -1523,6 +1540,9 @@ function change_mirrors_main() { diff_file $File_GentooMakeConfBackup $File_GentooMakeConf diff_file $File_GentooReposConfBackup $File_GentooReposConf ;; + "${SYSTEM_NIXOS}") + diff_file $File_NixConfBackup $File_NixConf + ;; esac fi } @@ -1559,6 +1579,9 @@ function change_mirrors_main() { "${SYSTEM_OPENKYLIN}") change_mirrors_openKylin ;; + "${SYSTEM_NIXOS}") + change_mirrors_NixOS + ;; esac ## 比较差异 if [[ "${PRINT_DIFF}" == "true" ]]; then @@ -1586,6 +1609,10 @@ function change_mirrors_main() { "${SYSTEM_GENTOO}") emerge --sync --quiet ;; + "${SYSTEM_NIXOS}") + nix-store --verify + nix-channel --update + ;; esac if [ $? -eq 0 ]; then echo -e "\n$SUCCESS 软件源更换完毕" @@ -1679,6 +1706,9 @@ function upgrade_software() { "${SYSTEM_GENTOO}") emerge --update --deep --with-bdeps=y --ask=n @world ;; + "${SYSTEM_NIXOS}") + nixos-rebuild switch + ;; esac if [[ "${CLEAN_CACHE}" == "false" ]]; then return @@ -1703,6 +1733,9 @@ function upgrade_software() { eclean-dist --deep >/dev/null 2>&1 eclean-packages --deep >/dev/null 2>&1 ;; + "${SYSTEM_NIXOS}") + nix-collect-garbage -d >/dev/null 2>&1 + ;; esac } @@ -2301,6 +2334,23 @@ deb ${1} ${2}-updates ${3} $(gen_source "${base_url}" "${SYSTEM_VERSION_CODENAME}" "${repository_sections}")" >>$File_DebianSourceList } +## 更换 NixOS 发行版软件源 +function change_mirrors_NixOS() { + local binary_cache_source channel_source + if [[ "${USE_OFFICIAL_SOURCE}" == "true" ]]; then + binary_cache_source="https://cache.nixos.org/" + channel_source="https://nixos.org/channels" + else + binary_cache_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}/store https://cache.nixos.org/" + channel_source="${WEB_PROTOCOL}://${SOURCE}/${SOURCE_BRANCH}" + fi + # binary cache + sed -i "s|^substituters.*|substituters = ${binary_cache_source}|g" $File_NixConf + # channel + nix-channel --add "${channel_source}/nixos-${SYSTEM_VERSION_NUMBER}" nixos + nix-channel --update >/dev/null 2>&1 +} + ## EPEL (Extra Packages for Enterprise Linux) 附加软件包 - 安装或更换软件源 function change_mirrors_or_install_EPEL() { if [[ "${INSTALL_EPEL}" != "true" ]]; then diff --git a/LICENSE b/LICENSE index 2833ae0b..386eb8e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 SuperManito +Copyright (c) 2025 SuperManito Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c7965ee9..95a9c9e8 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,11 @@ v3 / edge -  Gentoo +  Gentoo + all + + +  NixOS all @@ -116,7 +120,7 @@ ### LICENSE -Copyright © 2024, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE). +Copyright © 2025, [SuperManito](https://github.com/SuperManito). Released under the [MIT](https://github.com/SuperManito/LinuxMirrors/blob/main/LICENSE). diff --git a/docs/assets/images/icon/nixos.svg b/docs/assets/images/icon/nixos.svg new file mode 100644 index 00000000..415ac009 --- /dev/null +++ b/docs/assets/images/icon/nixos.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index d83b5ff0..55826f3e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -118,6 +118,7 @@ hide: | Arch Linux | _all_ | | Alpine Linux | _v3 / edge_ | | Gentoo | _all_ | +| NixOS | _19 ~ 24_ | diff --git a/docs/mirrors/index.md b/docs/mirrors/index.md index 53db2685..d58ef3d0 100644 --- a/docs/mirrors/index.md +++ b/docs/mirrors/index.md @@ -10,22 +10,22 @@ hide: > 下方列表中的镜像站均支持 `Debian` `Ubuntu` `CentOS` `openSUSE` `openEuler` 软件源,列表根据单位性质、地理位置、名称长度进行排序,与实际速度无关 -| 镜像站 | IPv6 | Arch Linux | Kali Linux | Deepin | Rocky Linux | AlmaLinux | EPEL :material-information-outline:{ title="EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版" } | Fedora | OpenCloudOS | Alpine Linux | Armbian | Proxmox | Linux Mint | Gentoo | Anolis OS | openKylin | -| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | -| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | -| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | -| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | -| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | -| [火山引擎](https://developer.volcengine.com/mirror "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | -| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | -| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | -| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | -| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | -| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | -| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: | -| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | -| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | -| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | +| 镜像站 | IPv6 | Arch Linux | Kali Linux | Deepin | Rocky Linux | AlmaLinux | EPEL :material-information-outline:{ title="EPEL (Extra Packages for Enterprise Linux) 是由 Fedora 组织维护的一个附加软件包仓库,它主要适用于除 Fedora 操作系统以外的红帽系 Linux 发行版" } | Fedora | OpenCloudOS | Alpine Linux | Armbian | Proxmox | Linux Mint | Gentoo | Anolis OS | openKylin | NixOS | +| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--: | +| [阿里云](https://mirrors.aliyun.com "mirrors.aliyun.com") | :supported: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :unsupport: | +| [腾讯云](https://mirrors.tencent.com "mirrors.tencent.com") | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | +| [华为云](https://mirrors.huaweicloud.com "mirrors.huaweicloud.com") | :unsupport: | :supported: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | +| [网易](https://mirrors.163.com "mirrors.163.com") | :unsupport: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | +| [火山引擎](https://developer.volcengine.com/mirror "mirrors.volces.com") | :unsupport: | :unsupport: | :supported: | :supported: | :incompatible: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | +| [清华大学](https://mirrors.tuna.tsinghua.edu.cn "mirrors.tuna.tsinghua.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | +| [北京大学](https://mirrors.pku.edu.cn/Mirrors "mirrors.pku.edu.cn") | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | +| [浙江大学](https://mirrors.zju.edu.cn "mirrors.zju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | +| [南京大学](https://mirrors.nju.edu.cn "mirrors.nju.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: +| [兰州大学](https://mirror.lzu.edu.cn "mirror.lzu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :unsupport: | +| [上海交通大学](https://mirror.sjtu.edu.cn "mirror.sjtu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :incompatible: | :incompatible: | :supported: | :incompatible: | :supported: | :unsupport: | :supported: | :incompatible: | :unsupport: | :supported: | :unsupport: | +| [重庆邮电大学](https://mirrors.cqupt.edu.cn "mirrors.cqu.edu.cn") | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | :unsupport: | +| [中国科学技术大学](https://mirrors.ustc.edu.cn "mirrors.ustc.edu.cn") | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :unsupport: | :supported: | +| [中国科学院软件研究所](https://mirror.iscas.ac.cn "mirror.iscas.ac.cn") | :unsupport: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :supported: | :unsupport: | :supported: | :supported: | ???+ question "使用帮助" diff --git a/docs/other/index.md b/docs/other/index.md index 04632621..a4e6997b 100644 --- a/docs/other/index.md +++ b/docs/other/index.md @@ -9,10 +9,6 @@ hide: ## :fontawesome-brands-docker:{style="color: #086dd7"} Docker 安装脚本 -???+ tip inline end "友情提示" - - 该脚本近期进行了大量优化,代码逻辑变动较大,如有问题请及时反馈 - @@ -72,7 +68,9 @@ hide: bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh) ``` -脚本参考 [官方文档](https://docs.docker.com/engine/install) 使用系统包管理工具安装,集成安装 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose (插件)`](https://docs.docker.com/compose/install/linux),支持选择或更换软件源以及镜像仓库、安装指定版本、重装等功能,支持 ARM 架构处理器 +集成安装 [`Docker Engine`](https://docs.docker.com/engine) 和 [`Docker Compose (插件)`](https://docs.docker.com/compose/install/linux),支持选择或更换软件源以及镜像仓库、安装指定版本、重装等功能,支持 ARM 架构处理器 + +脚本参考 [官方文档](https://docs.docker.com/engine/install) 采用官方提供的方法使用系统包管理工具进行安装,这意味着可安装的版本是由官方仓库决定的,本脚本不存在兼容性等问题。 > 注:Docker Compose 自 V2 版本起开始作为 Docker CLI 的一部分,不再需要单独安装,请使用 `docker compose` 命令替代 `docker-compose` diff --git a/docs/use/index.md b/docs/use/index.md index 3441065e..4d40d007 100644 --- a/docs/use/index.md +++ b/docs/use/index.md @@ -110,35 +110,35 @@ hide: 选项卡分别代表脚本内置软件源类型和获取脚本途径,请在使用前检查目标镜像站是否支持您所使用的操作系统,可以在[软件源列表](../mirrors/index.md)中查看具体有哪些软件源。 -- ### 注意事项 +!!! tip "默认自动备份原有软件源内容,如需了解更多请翻阅下方文档" -
+
- - :material-numeric-1:{style="color: #3CA7E5" .lg} __需使用 `ROOT` 用户执行脚本__ +- :material-numeric-1:{style="color: #3CA7E5" .lg} __需使用 `ROOT` 用户执行脚本__ - --- + --- - 切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 ROOT 账户设置密码(例如 Ubuntu)或系统默认禁止 ROOT 用户登录。 + 切换命令为 `sudo -i` 或 `su root`。不同系统使用的命令不同,因为部分系统没有在初始安装时为 ROOT 账户设置密码(例如 Ubuntu)或系统默认禁止 ROOT 用户登录。 - - :material-numeric-2:{style="color: #3CA7E5" .lg} __建议使用支持 `SSH` 的现代化终端应用__ +- :material-numeric-2:{style="color: #3CA7E5" .lg} __建议使用支持 `SSH` 的现代化终端应用__ - --- + --- - 如果你系统命令行界面的中文显示乱码那么将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。关于 SSH 服务部分系统会自动开启,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。 + 如果你系统命令行界面的中文显示乱码那么将导致无法查看交互内容,此外部分系统 GUI 图形界面的终端应用可能存在一些无法预料的显示问题。关于 SSH 服务部分系统会自动开启,否则请参考[开启方法](#关于开启-ssh-远程登录的方法)。 - - :material-numeric-3:{style="color: #3CA7E5" .lg} __如果是在新装系统上首次执行脚本__ +- :material-numeric-3:{style="color: #3CA7E5" .lg} __如果是在新装系统上首次执行脚本__ - --- + --- - 当前执行方式依赖 `curl` 指令获取脚本内容并执行,但部分操作系统没有预装此软件包,届时则会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。 + 当前执行方式依赖 `curl` 指令获取脚本内容并执行,但部分操作系统没有预装此软件包,届时则会报错 `Command not found`,安装方法详见下方 [_关于报错 Command not found_](#关于报错-command-not-found)。 - - :material-numeric-4:{style="color: #3CA7E5" .lg} __脚本运行期间需要交互选择配置__ +- :material-numeric-4:{style="color: #3CA7E5" .lg} __脚本运行期间需要交互选择配置__ - --- + --- - 请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常那么请改变终端软件的窗口大小后重试,窗口尽量不要太小。 + 请通过方向键 ++arrow-up++++arrow-down++++arrow-left++++arrow-right++ 或 ++w++++a++++s++++d++ 控制选项并按 ++enter++ 回车键确认。如果发现交互异常那么请改变终端软件的窗口大小后重试,窗口尽量不要太小。 -
+
- ### 常见问题 @@ -190,6 +190,12 @@ hide: emerge --ask curl ``` + === "NixOS" + + ``` bash + nix-env -iA nixos.curl + ``` + ??? tip "安装不上?(点击展开查看其它解决方法)" 假如系统原有软件源是无效的导致安装不上 `curl` 软件包,那么对于 Linux 初学者来说可能会比较麻烦,这里提供几个在线获取脚本的应急方法 @@ -316,12 +322,22 @@ hide: emerge --sync --quiet ``` + === "NixOS" + + ``` bash + cp -rf /etc/nix/nix.conf.bak /etc/nix/nix.conf + ``` + - #### 其它 !!! quote "" - 如果提示 `bash: /proc/self/fd/11: No such file or directory`,请切换至 `Root` 用户执行,切换命令为 `sudo -i` 或 `su root` +- ### 关于备份原有软件源 + + 脚本会自动备份原有软件源内容,备份路径为原有文件或目录的绝对路径加上 `.bak` 后缀,例如 `/etc/apt/sources.list => /etc/apt/sources.list.bak`,当检查到已存在备份内容时会询问是否覆盖备份。 + - ### 关于调用脚本的互联网位置 项目利用 [GitHub Action](https://github.com/SuperManito/LinuxMirrors/blob/main/.github/workflows/build-docs.yml#L24) 在每次提交后自动拷贝源码到文档目录作为网站资源发布,网站托管于知名 CDN 云服务商几乎没有被劫持的风险请放心使用。 @@ -330,15 +346,15 @@ hide: - ### 关于软件源下载速度相关问题 - 首先在[软件源列表](../mirrors/index.md)页面的使用帮助有使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。 + 首先,在[软件源列表](../mirrors/index.md)的使用帮助处有写使用推荐,这是根据以往经验总结出来的,但总有用户在纠结软件源速度的问题。 软件源(镜像站)的网络延迟即 `Ping` 与下载速度没有太大的关联,双方地理位置间隔的远近不代表实际体验,有些镜像站下行带宽很高但实际测速却并不理想,因为这与镜像站的并发性能和负载策略有关。 - 网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能。 + 网上也有很多基于 C、Python 编写的镜像站测速开源脚本,而本项目脚本基于 Bash Shell 编写且不依赖任何第三方库,Bash 是 Linux 运维中最常用的脚本语言并且绝大部分发行版都会预装,这意味着用户不需要安装任何环境就能直接运行,这种便利性是其它高级语言无法替代的,不过目前来看 Bash 脚本可能无法实现精准测速的功能,使用其它高级语言编写测速功能无疑是造轮子的行为。 -- ### 关于未启用的软件源 +- ### 关于未启用的软件源和仓库 - 脚本遵循系统默认设置即没有启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下: + 脚本遵循系统默认设置,默认不启用的软件源(仓库)不会在运行完本脚本后被启用,但是它们也随脚本更换了目标软件源地址,具体启用方法如下: === "Debian 系 / openKylin" @@ -434,6 +450,7 @@ hide: | Arch Linux | `archlinux` `archlinuxarm` | | Alpine Linux | `alpine` | | Gentoo | `gentoo` `gentoo-portage` | + | NixOS | `nix-channels` | 请看下面的例子 diff --git a/mkdocs.yml b/mkdocs.yml index 64766570..37ec4d17 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -2,7 +2,7 @@ site_name: LinuxMirrors repo_name: LinuxMirrors repo_url: https://github.com/SuperManito/LinuxMirrors edit_uri: edit/main/docs/ -copyright: 'Copyright © 2024 SuperManito' +copyright: 'Copyright © 2025 SuperManito' extra_css: - stylesheets/extra.css @@ -62,6 +62,7 @@ theme: - content.code.annotate - search.suggest - search.highlight + - search.share - announce.dismiss extra: generator: false diff --git a/requirements.txt b/requirements.txt index 075e43d8..4950bfa4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -mkdocs-material==9.5.50 +mkdocs-material==9.6.5 mkdocs-glightbox==0.4.0 mkdocs-exclude-search==0.6.6 \ No newline at end of file
Debian