mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
help: nix: split and transpile from mirrorz
Closes https://github.com/tuna/issues/issues/1692
a671071929
This commit is contained in:
parent
7cd716897f
commit
1bf92732b8
|
|
@ -4,7 +4,30 @@ layout: help
|
|||
mirrorid: nix
|
||||
---
|
||||
|
||||
## Nix 镜像使用帮助
|
||||
# Nix 镜像使用帮助
|
||||
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>是否使用 HTTPS</label>
|
||||
<select id="http-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2">
|
||||
<option data-http_protocol="https://" selected>是</option>
|
||||
<option data-http_protocol="http://">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>是否使用 sudo</label>
|
||||
<select id="sudo-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2">
|
||||
<option data-sudo="sudo " selected>是</option>
|
||||
<option data-sudo="">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
[Nix](https://nixos.org/nix) 是一个支持 Linux 和 macOS 的独特的“函数式包管理器”,具有原子更新、依赖隔离、构建尽可能可复现等特点。
|
||||
|
||||
|
|
@ -18,61 +41,55 @@ mirrorid: nix
|
|||
|
||||
- 单用户安装
|
||||
|
||||
```console
|
||||
$ sh <(curl https://{{ site.hostname }}/nix/latest/install)
|
||||
```
|
||||
|
||||
|
||||
{% raw %}
|
||||
<script id="template-0" type="x-tmpl-markup">
|
||||
sh <(curl {{http_protocol}}{{mirror}}/latest/install)
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-0" class="language-bash" data-template="#template-0" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
- 多用户安装:
|
||||
|
||||
```console
|
||||
$ sh <(curl https://{{ site.hostname }}/nix/latest/install) --daemon
|
||||
```
|
||||
|
||||
|
||||
如果需要,可以在[文件列表中手动挑选需要的版本](https://{{ site.hostname }}/nix)。
|
||||
{% raw %}
|
||||
<script id="template-1" type="x-tmpl-markup">
|
||||
sh <(curl {{http_protocol}}{{mirror}}/latest/install) --daemon
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
### NixOS
|
||||
<p></p>
|
||||
|
||||
NixOS 的安装镜像和 OVF 虚拟机镜像可以在镜像站首页“下载链接”处或 <https://{{ site.hostname }}/nixos-images/> 下载。
|
||||
<pre>
|
||||
<code id="content-1" class="language-bash" data-template="#template-1" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
### Nixpkgs binary cache
|
||||
|
||||
Binary cache 的镜像位于 <https://{{ site.hostname }}/nix-channels/store>,与 channel 同步更新。
|
||||
如果需要,可以在文件列表中手动挑选需要的版本
|
||||
|
||||
目前 nix-darwin 的 binary cache 并不工作,请使用官方源。
|
||||
|
||||
以优先选择镜像,备选源站为例,选择以下配置之一:
|
||||
|
||||
- 单独安装的 Nix:编辑配置文件添加或修改如下项(通常系统配置在 `/etc/nix/nix.conf`,用户配置在 `~/.config/nix/nix.conf`):
|
||||
{% raw %}
|
||||
<script id="template-2" type="x-tmpl-markup">
|
||||
{{http_protocol}}{{mirror}}
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
```plain
|
||||
substituters = https://{{ site.hostname }}/nix-channels/store https://cache.nixos.org/
|
||||
```
|
||||
<p></p>
|
||||
|
||||
- NixOS 21.11 及之前的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加)
|
||||
<pre>
|
||||
<code id="content-2" class="language-plaintext" data-template="#template-2" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
```nix
|
||||
nix.binaryCaches = [ "https://{{ site.hostname }}/nix-channels/store" ];
|
||||
```
|
||||
|
||||
- NixOS 22.05 及之后的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加):
|
||||
|
||||
```nix
|
||||
nix.settings.substituters = [ "https://{{ site.hostname }}/nix-channels/store" ];
|
||||
```
|
||||
|
||||
### Nixpkgs channel
|
||||
|
||||
Channel 的镜像位于 <https://{{ site.hostname }}/nix-channels/> 目录下,使用方式与 <https://nixos.org/channels/> 相同。
|
||||
|
||||
单独安装的 Nix 替换 `nixpkgs-unstable` 命令如下:
|
||||
|
||||
```console
|
||||
$ nix-channel --add https://{{ site.hostname }}/nix-channels/nixpkgs-unstable nixpkgs
|
||||
$ nix-channel --update
|
||||
```
|
||||
|
||||
替换 NixOS channel 命令如下(以 root 执行,将 `19.09` 替换为系统版本):
|
||||
|
||||
```console
|
||||
# nix-channel --add https://{{ site.hostname }}/nix-channels/nixos-19.09 nixos
|
||||
# nix-channel --update
|
||||
```
|
||||
|
|
|
|||
|
|
@ -0,0 +1,143 @@
|
|||
---
|
||||
category: help
|
||||
layout: help
|
||||
mirrorid: nix-channels
|
||||
---
|
||||
|
||||
# Nix Channels 镜像使用帮助
|
||||
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>是否使用 HTTPS</label>
|
||||
<select id="http-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2,#content-3,#content-4">
|
||||
<option data-http_protocol="https://" selected>是</option>
|
||||
<option data-http_protocol="http://">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>是否使用 sudo</label>
|
||||
<select id="sudo-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2,#content-3,#content-4">
|
||||
<option data-sudo="sudo " selected>是</option>
|
||||
<option data-sudo="">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
### Nixpkgs binary cache
|
||||
|
||||
目前并未提供 nix-darwin 的 binary cache,请使用官方源或 SJTUG。
|
||||
|
||||
以优先选择镜像,备选源站为例,选择以下配置之一:
|
||||
|
||||
- 单独安装的 Nix:编辑配置文件添加或修改如下项(多用户安装修改 `/etc/nix/nix.conf`,单用户安装修改 `~/.config/nix/nix.conf`):
|
||||
|
||||
|
||||
|
||||
{% raw %}
|
||||
<script id="template-0" type="x-tmpl-markup">
|
||||
substituters = {{http_protocol}}{{mirror}}/store https://cache.nixos.org/
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-0" class="language-plaintext" data-template="#template-0" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
- NixOS 21.11 及之前的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加)
|
||||
|
||||
|
||||
|
||||
{% raw %}
|
||||
<script id="template-1" type="x-tmpl-markup">
|
||||
nix.binaryCaches = [ "{{http_protocol}}{{mirror}}/store" ];
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-1" class="language-nix" data-template="#template-1" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
- NixOS 22.05 及之后的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加):
|
||||
|
||||
|
||||
|
||||
{% raw %}
|
||||
<script id="template-2" type="x-tmpl-markup">
|
||||
nix.settings.substituters = [ "{{http_protocol}}{{mirror}}/store" ];
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-2" class="language-nix" data-template="#template-2" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
### Nixpkgs channel
|
||||
|
||||
单独安装的 Nix 替换 `nixpkgs-unstable` 命令如下:
|
||||
|
||||
|
||||
|
||||
{% raw %}
|
||||
<script id="template-3" type="x-tmpl-markup">
|
||||
nix-channel --add {{http_protocol}}{{mirror}}/nixpkgs-unstable nixpkgs
|
||||
nix-channel --update
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-3" class="language-bash" data-template="#template-3" data-select="#http-select,#sudo-select">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
替换 NixOS channel 命令如下(以 root 执行):
|
||||
|
||||
|
||||
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>系统版本:</label>
|
||||
<select id="select-4-0" class="form-control content-select" data-target="#content-4">
|
||||
<option data-version="22.11" selected>22.11</option>
|
||||
<option data-version="unstable">unstable</option>
|
||||
<option data-version="22.05">22.05</option>
|
||||
<option data-version="21.11">22.11</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% raw %}
|
||||
<script id="template-4" type="x-tmpl-markup">
|
||||
nix-channel --add {{http_protocol}}{{mirror}}/nixos-{{version}} nixos
|
||||
nix-channel --update
|
||||
</script>
|
||||
{% endraw %}
|
||||
|
||||
<p></p>
|
||||
|
||||
<pre>
|
||||
<code id="content-4" class="language-bash" data-template="#template-4" data-select="#http-select,#sudo-select,#select-4-0">
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue