-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With nix options changes, first substituter is always cache.nixos.org #158356
Comments
The order of cache queries is actually determined by a metadata file served by the caches.
I suppose this will only affect you if the caches have an equal priority number.
This can be achieved by putting a cc @domenkozar fyi |
After a git bisect, I found that the behavior changed with commit 4a9d992 Prior to this and the renaming, |
cc @polykernel |
This seems to be caused by non-determinism in the merging order of definitions with the same priority. In the I also noticed that |
I confirm this has been fixed since I made the issue. |
Everyone, if you have time you're welcome to chime in at #8101 I quote "It seems people want this automatic appending [of "cache.nixos.org"], which feels strange to me. What about people who also want to offload the cache downloading [and not just building] to the build machine?" |
In my particular situation, the default cache "https://cache.nixos.org/" was completely unreachable, yet it continued to be appended to the substituters, causing the nix-* commands to attempt to download and check its priority in vain. The issue was resolved by using # configuration.nix
{ config, pkgs, lib, ... }:
{
# ...
nix.settings.substituters = lib.mkForce [ "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" ];
# ...
} I hope the code above can be helpful for someone who has encountered the same problem and reached here through searching. |
Add code to demonstrate how to prevent the automatic appending of the default cache site, which can be especial helpful for users who are completely unable to reach the site: See also: NixOS/nixpkgs#158356 (comment)
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-channel-update-on-isolated-system/48588/1 |
Describe the bug
It seems with the move from
nix.binaryCaches
tonix.settings.substituters
, the first substitutes server is alwayshttps://cache.nixos.org
which defeats the use of a local caching server./etc/nix/nix.conf
withnix.settings.substituters = [ "http://10.42.42.150/" "https://cache.nixos.org" ];
If I use mkForce to force a value with
nix.settings.substituters = pkgs.lib.mkForce [ "http://10.42.42.150/" "https://cache.nixos.org" ];
I get the following/etc/nix/nix.conf
Steps To Reproduce
Define a custom substituter
nix.settings.substituters = [ "http://10.42.42.150/" ];
, checkgrep ^substituters /etc/nix/nix.conf
, you will havehttps://cache.nixos.org
first in the list.Expected behavior
It seems
https://cache.nixos.org
is always merged first in the list, it should be merged after the user defined value.Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: