Binary Cache: Difference between revisions

imported>Milahu
make shell code simpler
imported>Milahu
add Permanent use of binary cache
Line 116: Line 116:


To configure Nix to use a certain binary cache, refer to the Nix manual.<ref group="cf.">[https://nixos.org/nix/manual/#ch-files Nix Manual, 21. Files]</ref> Add the binary cache as substituter (see the options {{ic|substituters}} and {{ic|extra-substituters}}) and the public key to the trusted keys (see {{ic|trusted-public-keys}}).
To configure Nix to use a certain binary cache, refer to the Nix manual.<ref group="cf.">[https://nixos.org/nix/manual/#ch-files Nix Manual, 21. Files]</ref> Add the binary cache as substituter (see the options {{ic|substituters}} and {{ic|extra-substituters}}) and the public key to the trusted keys (see {{ic|trusted-public-keys}}).
Permanent use of binary cache:
<syntaxhighlight lang="nix">
# /etc/nixos/configuration.nix
  nix = {
    binaryCaches = [
      "http://binarycache.example.com"
      "https://nix-community.cachix.org"
      "https://cache.nixos.org/"
    ];
    binaryCachePublicKeys = [
      "binarycache.example.com-1:dsafdafDFW123fdasfa123124FADSAD"
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
    ];
  };
</syntaxhighlight>
Temporary use of binary cache:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 179: Line 199:


<references group="cf."/>
<references group="cf."/>
* [https://discourse.nixos.org/t/how-to-use-binary-cache-in-nixos/5202/4 How to use binary cache in NixOS]