Enterprise: Difference between revisions

imported>Makefu
No edit summary
imported>Makefu
syntaxHighlight
Line 22: Line 22:
  build-sandbox-paths = /etc/nix/netrc
  build-sandbox-paths = /etc/nix/netrc


Lastly, the builds need to know that they need to use the netrc file in fetchurl. We will override the definition of fetchurl to include <code>--netrc-file /etc/nix/netrc</code> in the curl options used by fetchurl. The following shows how this might look in your Nix file:
Lastly, the builds need to know that they need to use the netrc file in <code>fetchurl</code>. We will override the definition of <code>fetchurl</code> to include <code>--netrc-file /etc/nix/netrc</code> in the curl options used by <code>fetchurl</code>. The following shows how this might look in your Nix file:
 
<syntaxHighlight lang=nix>
  let pkgs = import <nixpkgs> {
  let pkgs = import <nixpkgs> {
   config = {
   config = {
Line 30: Line 30:
         curlOpts = "${pkgs.lib.optionalString (opts ? curlOpts) "${opts.curlOpts}"} --netrc-file /etc/nix/netrc";
         curlOpts = "${pkgs.lib.optionalString (opts ? curlOpts) "${opts.curlOpts}"} --netrc-file /etc/nix/netrc";
       });
       });
       fetchrurl = fetchurlPrivate;
       fetchurl = fetchurlPrivate;
   };
   };
  }
  }
  in
  in
...
  ...
</syntaxHighlight>


Now all fetchurl calls will use the specified netrc file with the credentials of your choice.
Now all '''fetchurl''' calls will use the specified netrc file with the credentials of your choice.


== SSL Intercepting Proxy ==
== SSL Intercepting Proxy ==


As of right now there currently does not seem to be a way to install nix packages via an intercepting proxy, see [https://github.com/NixOS/nix/issues/1896 nix issue #1896] . The proxy itself can be set via the environment variables <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code>.
As of right now there currently does not seem to be a way to install nix packages via an intercepting proxy, see [https://github.com/NixOS/nix/issues/1896 nix issue #1896] . The proxy itself can be set via the environment variables <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code>.