Skip to content

Option to disable binary cache #20542

Closed
Closed

Description

@spacekitteh

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

Activity

  1. joachifm commented on Nov 19, 2016

    @joachifm
    Contributor

    Why?

  2. spacekitteh commented on Nov 19, 2016

    @spacekitteh
    ContributorAuthor

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

  3. joachifm commented on Nov 19, 2016

    @joachifm
    Contributor

    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.

  4. vcunat commented on Nov 19, 2016

    @vcunat
    Member

    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.

  5. added
    6.topic: nixos
    on Nov 19, 2016
  6. NeQuissimus commented on Nov 20, 2016

    @NeQuissimus
    Member

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

  7. spacekitteh commented on Nov 20, 2016

    @spacekitteh
    ContributorAuthor

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

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

  8. vcunat commented on Nov 20, 2016

    @vcunat
    Member

    @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.

  9. vcunat commented on Nov 20, 2016

    @vcunat
    Member

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

  10. spacekitteh commented on Nov 20, 2016

    @spacekitteh
    ContributorAuthor

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

    nix nix.buildCores = 0;

  11. joachifm commented on Nov 24, 2016

    @joachifm
    Contributor

    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.

  12. spinus commented on Apr 8, 2017

    @spinus
    Member

    As @joachifm mentioned:
    from man nix.conf

           build-use-substitutes
               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.

  13. nh2 commented on Sep 5, 2017

    @nh2
    Contributor

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

  14. joachifm commented on Sep 5, 2017

    @joachifm
    Contributor

    Agreed.

  15. jskrzypek commented on Oct 24, 2020

    @jskrzypek
    Contributor

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

           build-use-substitutes
               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

  16. augyg commented on Dec 4, 2022

    @augyg

    How am I supposed to stop using a cache then? I am pretty sure that the cache I was pulling from is no longer in service but it's set in my nix.conf file

    besides passing the same option to not use caches each time.

  17. jeff-hykin commented on Feb 4, 2023

    @jeff-hykin

    This is still an issue on nix 2.12. Rather than gentoo-esk reasons I need it for trying to understand how nixpkgs works (order of evaluation) and estimating build times.

    nix \
        --extra-experimental-features 'nix-command flakes' \
        build \
        -vvvvv \
        --option build-use-substitutes false \
        --option substitute false \
        --substituters '' \
        '.#cowsay'
    
    
    evaluating derivation 'git+file:///Users/jeffhykin/repos/nixpkgs-skeleton#cowsay'...
    resolved HEAD ref 'refs/heads/master' for repo '/Users/jeffhykin/repos/nixpkgs-skeleton'
    using revision 4fa7caa4a20fa392451267f711b7104fb083c36e of repo '/Users/jeffhykin/repos/nixpkgs-skeleton'
    acquiring write lock on '/nix/var/nix/temproots/1089'
    using cache entry '{"name":"source","rev":"4fa7caa4a20fa392451267f711b7104fb083c36e","type":"git"}' -> '{"lastModified":1674427778,"rev":"4fa7caa4a20fa392451267f711b7104fb083c36e","revCount":2}', '/nix/store/bykjr6l0p8if3n1b5ysmhg213f2cznxz-source'
    got tree '/nix/store/bykjr6l0p8if3n1b5ysmhg213f2cznxz-source' from 'git+file:///Users/jeffhykin/repos/nixpkgs-skeleton?ref=refs%2fheads%2fmaster&rev=4fa7caa4a20fa392451267f711b7104fb083c36e'
    checking access to '/nix/store/bykjr6l0p8if3n1b5ysmhg213f2cznxz-source/flake.nix'
    evaluating file '/nix/store/bykjr6l0p8if3n1b5ysmhg213f2cznxz-source/flake.nix'
    old lock file: {
      "nodes": {
        "root": {}
      },
      "root": "root",
      "version": 7
    }
    computing lock file node ''
    new lock file: {
      "nodes": {
        "root": {}
      },
      "root": "root",
      "version": 7
    }
    trying flake output attribute 'packages.aarch64-darwin.cowsay'
    using cached attrset attribute ''
    trying flake output attribute 'legacyPackages.aarch64-darwin.cowsay'
    using cached string attribute 'legacyPackages.aarch64-darwin.cowsay.type'
    using cached string attribute 'legacyPackages.aarch64-darwin.cowsay.drvPath'
    using cached list of strings attribute 'legacyPackages.aarch64-darwin.cowsay.meta.outputsToInstall'
    querying info about missing paths...
    starting pool of 24 threads
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: created
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: woken up
    querying info about missing paths...
    starting pool of 24 threads
    entered goal loop
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: init
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: loading derivation
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: have derivation
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: done
    building of '/nix/store/54arbcss46kicrgqxfd0xbllb5dmn6zs-cowsay-3.7.0.drv!man,out' from .drv file: goal destroyed
    
    nixpkgs-skeleton on  master [$?] 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: nixos

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions