# Hex mirror (pkg.shecan.ir)

> Mirror of the Hex package registry (repo.hex.pm) for Mix (Elixir) and rebar3 (Erlang), including the Hex and rebar builds that mix local.hex and mix local.rebar download from builds.hex.pm.

- Upstream: repo.hex.pm, builds.hex.pm
- Mirror URL: <https://mirror-hex.pkg.shecan.ir>
- Clients: mix, rebar3
- Service status: <https://pkg.shecan.ir/status.json> (key `hex`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/hex/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/hex.json>

## Limitations

- Read-only and public packages only: organisations (private repositories), mix hex.publish and the hex.pm API (search, mix hex.outdated, mix hex.audit) are not served.
- The registry is signed by hex.pm and checked by the client; HEX_MIRROR and HEX_CDN only change where files are downloaded from.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### mix: persistent (user- or system-wide configuration)

Run (linux, macos)

```sh
export HEX_MIRROR=https://mirror-hex.pkg.shecan.ir
```

Undo / restore the default (linux, macos)

```sh
unset HEX_MIRROR
sed -i.bak -E '/^export (HEX_MIRROR)=/d' ~/.bashrc ~/.zshrc ~/.profile 2>/dev/null || true
```

Run (windows) (checked by hand)

```powershell
[Environment]::SetEnvironmentVariable('HEX_MIRROR', 'https://mirror-hex.pkg.shecan.ir', 'User')
```

Undo / restore the default (windows) (checked by hand)

```powershell
[Environment]::SetEnvironmentVariable('HEX_MIRROR', $null, 'User')
```

### rebar3: persistent (user- or system-wide configuration)

Run (linux, macos)

```sh
export HEX_CDN=https://mirror-hex.pkg.shecan.ir
```

Undo / restore the default (linux, macos)

```sh
unset HEX_CDN
sed -i.bak -E '/^export (HEX_CDN)=/d' ~/.bashrc ~/.zshrc ~/.profile 2>/dev/null || true
```
