diff --git a/help/_posts/2019-02-17-nix.md b/help/_posts/2019-02-17-nix.md index 472be35..edd4178 100644 --- a/help/_posts/2019-02-17-nix.md +++ b/help/_posts/2019-02-17-nix.md @@ -4,7 +4,30 @@ layout: help mirrorid: nix --- -## Nix 镜像使用帮助 +# Nix 镜像使用帮助 + +
+
+ + +
+
+ + +
+
+ + +
+
+ + [Nix](https://nixos.org/nix) 是一个支持 Linux 和 macOS 的独特的“函数式包管理器”,具有原子更新、依赖隔离、构建尽可能可复现等特点。 @@ -18,61 +41,55 @@ mirrorid: nix - 单用户安装 - ```console - $ sh <(curl https://{{ site.hostname }}/nix/latest/install) - ``` + + +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ + - 多用户安装: - ```console - $ sh <(curl https://{{ site.hostname }}/nix/latest/install) --daemon - ``` + -如果需要,可以在[文件列表中手动挑选需要的版本](https://{{ site.hostname }}/nix)。 +{% raw %} + +{% endraw %} -### NixOS +

-NixOS 的安装镜像和 OVF 虚拟机镜像可以在镜像站首页“下载链接”处或 下载。 +
+
+
+
-### Nixpkgs binary cache -Binary cache 的镜像位于 ,与 channel 同步更新。 +如果需要,可以在文件列表中手动挑选需要的版本 -目前 nix-darwin 的 binary cache 并不工作,请使用官方源。 -以优先选择镜像,备选源站为例,选择以下配置之一: -- 单独安装的 Nix:编辑配置文件添加或修改如下项(通常系统配置在 `/etc/nix/nix.conf`,用户配置在 `~/.config/nix/nix.conf`): +{% raw %} + +{% endraw %} - ```plain - substituters = https://{{ site.hostname }}/nix-channels/store https://cache.nixos.org/ - ``` +

-- NixOS 21.11 及之前的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加) +
+
+
+
- ```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 的镜像位于 目录下,使用方式与 相同。 - -单独安装的 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 -``` diff --git a/help/_posts/2023-03-10-nix-channels.md b/help/_posts/2023-03-10-nix-channels.md new file mode 100644 index 0000000..b6627ed --- /dev/null +++ b/help/_posts/2023-03-10-nix-channels.md @@ -0,0 +1,143 @@ +--- +category: help +layout: help +mirrorid: nix-channels +--- + +# Nix Channels 镜像使用帮助 + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +### Nixpkgs binary cache + +目前并未提供 nix-darwin 的 binary cache,请使用官方源或 SJTUG。 + +以优先选择镜像,备选源站为例,选择以下配置之一: + +- 单独安装的 Nix:编辑配置文件添加或修改如下项(多用户安装修改 `/etc/nix/nix.conf`,单用户安装修改 `~/.config/nix/nix.conf`): + + + +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ + +- NixOS 21.11 及之前的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加) + + + +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ + +- NixOS 22.05 及之后的版本在 `configuration.nix` 中使用如下配置(https://cache.nixos.org 会被自动添加): + + + +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ + +### Nixpkgs channel + +单独安装的 Nix 替换 `nixpkgs-unstable` 命令如下: + + + +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ + +替换 NixOS channel 命令如下(以 root 执行): + + + +
+
+ + +
+
+ +{% raw %} + +{% endraw %} + +

+ +
+
+
+
+ +