Nix Channels

Nixpkgs binary cache

目前并未提供 nix-darwin 的 binary cache,请使用官方源或 SJTUG。

持久配置

以优先选择镜像,备选源站为例,选择以下配置之一:

  • 单独安装的 Nix:编辑配置文件添加或修改如下项(多用户安装修改 /etc/nix/nix.conf,单用户安装修改 ~/.config/nix/nix.conf):


    substituters = {{endpoint}}/store https://cache.nixos.org/

  • NixOS 21.11 及之前的版本在 configuration.nix 中使用如下配置(https://cache.nixos.org 会被自动添加)


    nix.binaryCaches = [ "{{endpoint}}/store" ];

  • NixOS 22.05 及之后的版本在 configuration.nix 中使用如下配置(https://cache.nixos.org 会被自动添加):


    nix.settings.substituters = [ "{{endpoint}}/store" ];

如果因为无法访问 https://cache.nixos.org 等原因,希望避免自动添加该默认地址,请在配置中使用lib.mkForce

# load `lib` into namespace at the file head with `{ config, pkgs, lib, ... }:`
nix.settings.substituters = lib.mkForce [ "{{endpoint}}/store" ];

临时使用

在安装 NixOS 时临时使用:

nixos-install --option substituters "{{endpoint}}/store"

在 NixOS 切换配置时临时使用:

nixos-rebuild --option substituters "{{endpoint}}/store"

临时关闭可以通过清空 substituters 实现:

nixos-rebuild --options substituters ""

Nixpkgs channel

单独安装的 Nix 替换 nixpkgs-unstable 命令如下:

nix-channel --add {{endpoint}}/nixpkgs-unstable nixpkgs
nix-channel --update

替换 NixOS channel 命令如下(以 root 执行):

nix-channel --add {{endpoint}}/nixos-{{version}} nixos
nix-channel --update

本站由兰州大学开源社区支持创办,由兰州大学开源社区维护。

本站相关源码可在 这里(镜像管理器)这里(镜像站网页) 获取。

根据相关法律法规,本站不对欧盟用户提供服务。

Contact Us

本站由兰州大学开源社区支持创办,由兰州大学开源社区维护。

本站相关源码可在 这里(镜像管理器)这里(镜像站网页) 获取。

根据相关法律法规,本站不对欧盟用户提供服务。

Contact Us

envelope hashtag github weibo