Nixpkgs: Option to disable binary cache

Created on 19 Nov 2016  路  14Comments  路  Source: NixOS/nixpkgs

Issue description

Setting nix.binaryCaches = []; nix.trustedBinaryCaches=[]; doesn't do anything; it still uses the default caches.

Technical details

  • System: master
  • Nix version: 1.11.4
  • Nixpkgs version: master
nixos

Most helpful comment

I'm a gentoo girl _shrugs_ I prefer building from source when possible.

All 14 comments

Why?

I'm a gentoo girl _shrugs_ I prefer building from source when possible.

Barring impurities, the substitute you get from the cache should be the exact same thing you'd end up with by building it yourself. I prefer to think of it not as "building software" but as selecting from an immutable universe of artefacts (aka the Store). The fact that this sometimes involves running build commands locally is conceptually irrelevant.

I could see a case for privacy, however. I think the most reliable way to achieve this is to blackhole requests to cache.nixos.org.

These setting types are additive, i.e. all instances are collected and concatenated together.

IIRC it can be done by nix.binaryCaches = lib.mkForce [ ]; or something similar.

Why not just pass --option use-binary-caches false to nixos-rebuild or nix-env?

@vcunat I don't think that works. I just tried it.

@NeQuissimus every time I upgrade? Hell no. I follow master.

@spacekitteh: what does your /etc/nix/nix.conf contain? When I set the above line, I do get an empty binary-caches setting in the config file.

BTW, always passing the options doesn't necessarily mean you have to type them. Bash aliases are useful for such things, for example.

It contains exactly that line you provided. It also contains, among other things:

nix nix.buildCores = 0;

Have you tried adding use-binary-caches to nix.extraOptions? If you really want to build from source every time, there's also build-use-substitutes.

As @joachifm mentioned:
from man nix.conf

           If set to true (default), Nix will use binary substitutes if available. This option can
           be disabled to force building from source.

probably that's the way.
@spacekitteh let us know if that's working for you.

Can we close this? What @spinus summarised, or --option build-use-substitutes false on the command line, is the option to disable binary caches.

Agreed.

As a notice for future visitors, at some point the option mentioned above was deprecated, and now man nix.conf gives this:

           Deprecated: build-use-substitutes is now an alias to substitute.

Which means that --option build-use-substitutes false will likely work, but you can pass --option substitute false as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

copumpkin picture copumpkin  路  3Comments

ayyess picture ayyess  路  3Comments

spacekitteh picture spacekitteh  路  3Comments

retrry picture retrry  路  3Comments