From 1fd874b7ea8a1272c9aa0b3b7b1c7712564cd911 Mon Sep 17 00:00:00 2001 From: Diep Pham Date: Sat, 4 Apr 2020 10:45:44 +0700 Subject: [PATCH] go: add goPrivate option This option configures the `GOPRIVATE` variable. See https://golang.org/cmd/go/#hdr-Module_configuration_for_non_public_modules for more information. PR #1126 --- modules/programs/go.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/programs/go.nix b/modules/programs/go.nix index 983769d26..4b85ec854 100644 --- a/modules/programs/go.nix +++ b/modules/programs/go.nix @@ -62,6 +62,18 @@ in { example = ".local/bin.go"; description = "GOBIN relative to HOME"; }; + + goPrivate = mkOption { + type = with types; listOf str; + default = [ ]; + example = [ "*.corp.example.com" "rsc.io/private" ]; + description = '' + The GOPRIVATE environment variable controls + which modules the go command considers to be private (not + available publicly) and should therefore not use the proxy + or checksum database. + ''; + }; }; }; @@ -85,5 +97,9 @@ in { home.sessionVariables.GOBIN = builtins.toPath "${config.home.homeDirectory}/${cfg.goBin}"; }) + + (mkIf (cfg.goPrivate != [ ]) { + home.sessionVariables.GOPRIVATE = concatStringsSep "," cfg.goPrivate; + }) ]); }