mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-22 00:20:58 +00:00
buildGo{Module,Package}: respect nix hardening flags when setting buildmode
This commit is contained in:
@@ -188,6 +188,12 @@ let
|
||||
''}
|
||||
'' + ''
|
||||
|
||||
# currently pie is only enabled by default in pkgsMusl
|
||||
# this will respect the `hardening{Disable,Enable}` flags if set
|
||||
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
|
||||
export GOFLAGS="-buildmode=pie $GOFLAGS"
|
||||
fi
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
|
||||
@@ -134,6 +134,12 @@ let
|
||||
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
|
||||
# currently pie is only enabled by default in pkgsMusl
|
||||
# this will respect the `hardening{Disable,Enable}` flags if set
|
||||
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
|
||||
export GOFLAGS="-buildmode=pie $GOFLAGS"
|
||||
fi
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user