From ed5d274df7adc1160c73ad5826dbb5f9206c684f Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:51:39 +0100 Subject: [PATCH] nixos/athens: update docs Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- nixos/modules/services/development/athens.md | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/development/athens.md b/nixos/modules/services/development/athens.md index 2795930b0a02..6f8181561913 100644 --- a/nixos/modules/services/development/athens.md +++ b/nixos/modules/services/development/athens.md @@ -37,7 +37,7 @@ If you want to prevent Athens from writing to disk, you can instead configure it } ``` -To use the local proxy in Go builds, you can set the proxy as environment variable: +To use the local proxy in Go builds (outside of `nix`), you can set the proxy as environment variable: ```nix { @@ -47,6 +47,21 @@ To use the local proxy in Go builds, you can set the proxy as environment variab } ``` -It is currently not possible to use the local proxy for builds done by the Nix daemon. This might be enabled -by experimental features, specifically [`configurable-impure-env`](https://nixos.org/manual/nix/unstable/contributing/experimental-features#xp-feature-configurable-impure-env), -in upcoming Nix versions. +To 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. + +This can either be done via the nix-daemon systemd unit: + +```nix +{ + systemd.services.nix-daemon.environment.GOPROXY = "http://localhost:3000"; +} +``` + +or via the [impure-env experimental feature](https://nix.dev/manual/nix/2.24/command-ref/conf-file#conf-impure-env): + +```nix +{ + nix.settings.experimental-features = [ "configurable-impure-env" ]; + nix.settings.impure-env = "GOPROXY=http://localhost:3000"; +} +```