Skip to the content.

Julia (Pkg)

Use the proxy as the Pkg server. The examples use the upstream name julia; replace it with the name your operator gave the upstream (what you need).

   
Upstream type julia
Package source https://proxy.example.com/v1/julia
Clients julia (Pkg)
Tested Julia 1.10: in CI on every push and in the client lab.

Configure

export JULIA_PKG_SERVER=https://proxy.example.com/v1/julia

Set it in the shell profile, or in ~/.julia/config/startup.jl as ENV["JULIA_PKG_SERVER"] = "…". The registry, package and artifact downloads all go to the Pkg server.

Authenticate

Only when the proxy has access control switched on. Pkg keeps a server’s token in a file named after the server’s host and sends it as a bearer token. ~/.julia/servers/proxy.example.com/auth.toml:

access_token = "<token>"

Trust a private CA

export JULIA_SSL_CA_ROOTS_PATH=/etc/ssl/corp-ca.pem

Check that it works

julia -e 'using Pkg; Pkg.add(name="Example", version="0.5.3"); using Example; println(Example.hello("lab"))'

Pkg.pkg_server() returns the server in effect.

Good to know

On the proxy

upstreams:
  julia:
    type: julia
    url: https://pkg.julialang.org

Every resource but the registry list is addressed by its Git tree hash, which the proxy recomputes over the tarball before caching it. Details: backends: julia.