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
This commit is contained in:
Diep Pham 2020-04-04 10:45:44 +07:00 committed by Robert Helgesson
parent 5ff245790d
commit 1fd874b7ea
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -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 <envar>GOPRIVATE</envar> 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;
})
]);
}