Allow passing null as modules for packages that don't have dependencies or that vendor them

This commit is contained in:
adisbladis 2022-08-24 14:54:36 +08:00
parent 0f5574480e
commit 94dc447f5c

View file

@ -221,7 +221,7 @@ let
, ...
}@attrs:
let
modulesStruct = fromTOML (readFile modules);
modulesStruct = if modules == null then { } else fromTOML (readFile modules);
goModPath = "${toString pwd}/go.mod";
@ -268,10 +268,13 @@ let
export GOSUMDB=off
export GOPROXY=off
cd "$modRoot"
if [ -n "${vendorEnv}" ]; then
${optionalString (modulesStruct != { }) ''
if [ -n "${vendorEnv}" ]; then
rm -rf vendor
cp -r ${vendorEnv} vendor
fi
fi
''}
runHook postConfigure
'';