1# Athens {#module-athens}
2
3*Source:* {file}`modules/services/development/athens.nix`
4
5*Upstream documentation:* <https://docs.gomods.io/>
6
7[Athens](https://github.com/gomods/athens)
8is a Go module datastore and proxy
9
10The main goal of Athens is providing a Go proxy (`$GOPROXY`) in regions without access to `https://proxy.golang.org` or to
11improve the speed of Go module downloads for CI/CD systems.
12
13## Configuring {#module-services-development-athens-configuring}
14
15A complete list of options for the Athens module may be found
16[here](#opt-services.athens.enable).
17
18## Basic usage for a caching proxy configuration {#opt-services-development-athens-caching-proxy}
19
20A very basic configuration for Athens that acts as a caching and forwarding HTTP proxy is:
21```nix
22{
23 services.athens = {
24 enable = true;
25 };
26}
27```
28
29If you want to prevent Athens from writing to disk, you can instead configure it to cache modules only in memory:
30
31```nix
32{
33 services.athens = {
34 enable = true;
35 storageType = "memory";
36 };
37}
38```
39
40To use the local proxy in Go builds (outside of `nix`), you can set the proxy as environment variable:
41
42```nix
43{
44 environment.variables = {
45 GOPROXY = "http://localhost:3000";
46 };
47}
48```
49
50To also use the local proxy for Go builds happening in `nix` (with `buildGoModule`), the nix daemon can be configured to pass the GOPROXY environment variable to the `goModules` fixed-output derivation.
51
52This can either be done via the nix-daemon systemd unit:
53
54```nix
55{
56 systemd.services.nix-daemon.environment.GOPROXY = "http://localhost:3000";
57}
58```
59
60or via the [impure-env experimental feature](https://nix.dev/manual/nix/2.24/command-ref/conf-file#conf-impure-env):
61
62```nix
63{
64 nix.settings.experimental-features = [ "configurable-impure-env" ];
65 nix.settings.impure-env = "GOPROXY=http://localhost:3000";
66}
67```