LnL7 / nix-darwin

nix modules for darwin
MIT License
2.83k stars 432 forks source link

nix-darwin ignores changes to nix.settings.substituters #548

Open champignoom opened 1 year ago

champignoom commented 1 year ago

After switching from the binary cache mirror at SJTU to the one at USTC by changing nix.settings.substituters = [ "https://mirror.sjtu.edu.cn/nix-channels/store" ]; to nix.settings.substituters = [ "https://mirrors.ustc.edu.cn/nix-channels/store" ];, nix-darwin still tries to use the old (unavailable) mirror instead of the new one:

$ darwin-rebuild switch
building the system configuration...
warning: error: unable to download 'https://mirror.sjtu.edu.cn/nix-channels/store/fj5grkzn4vmq1sd35831lyqiqhn5k40h.narinfo': Timeout was reached (28); retrying in 330 ms
warning: error: unable to download 'https://mirror.sjtu.edu.cn/nix-channels/store/fj5grkzn4vmq1sd35831lyqiqhn5k40h.narinfo': Timeout was reached (28); retrying in 533 ms
...
dhess commented 1 year ago

I suspect what's happening is that darwin-rebuild switch is using your current substituters, not the new ones you've defined in your config. The changes to your config don't take effect until the darwin-rebuild switch is completed.

You might be able to override them in your ~/.config/nix/nix.conf — I'm not sure whether darwin-rebuild will see your local config — otherwise you may need to temporarily hack your /etc/nix/nix.conf with the new substituters so that you can successfully deploy the new config.