Nix-channel --update on isolated system

So when I tried to use a binary cache, I kept finding that whenever I ran nix-channel --update, it kept trying to reach out to for instead of, which is my binary cache which is hosted locally on my network, even when I pointed it to the right URL where I stored the nixexprs.tar.xz accessible from within the network. It is a simple nginx reverse proxy like: FAQ/Private Cache Proxy - NixOS Wiki

I tried the following to stop it from doing that:

  • nix-channel --update --option substituters
  • NIX_SUBSTITUTERS='' nix-channel --update
  • nix-channel --update --option binary-caches

The ONLY way to do it is to rebuild the system with the following enabled:

nix.settings.substituters = lib.mkForce [ "" ];

As shown here: With nix options changes, first substituter is always · Issue #158356 · NixOS/nixpkgs · GitHub

And then only after running nixos-rebuild --option substituters switch would nix-channel --update succeed. (FWIW, I already was able to host the nixexprs.tar.xz needed to point to the right derivations. Since this was offline except for the cache servers, this was necessary to host on that same nginx server.)

It’s not ideal to rebuild the system (these are servers) before updating the list of packages, but as long as my base image isn’t too old, it works. (I’ll have to update from 23.11 soon haha)

EDIT: Looks like the fix for too


nix.settings.substituters = lib.mkForce [ "" ];

should do the trick. See also: Setting up a private Nix cache for fun and profit