From 36adb78950744bc7d357ebff308d4a1d41167e3d Mon Sep 17 00:00:00 2001 From: HuangYi Date: Fri, 2 Sep 2022 15:33:37 +0800 Subject: [PATCH] make updateScript to work Closes: #91 `updateScript` will use the same golang version to update the project. --- builder/default.nix | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/builder/default.nix b/builder/default.nix index 7dd69ed..3d53088 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -8,8 +8,7 @@ , cacert , pkgs , pkgsBuildBuild -, runtimeShell -, writeScript +, writeShellScript , gomod2nix }: let @@ -404,7 +403,6 @@ let passthru = { inherit go vendorEnv; - } // optionalAttrs (hasAttr "goPackagePath" modulesStruct) { updateScript = let @@ -415,13 +413,12 @@ let ( map (subPackage: modulesStruct.goPackagePath + "/" + subPackage) modulesStruct.subPackages ) - else modulesStruct.goPackagePath; - + else (modulesStruct.goPackagePath or ""); + helper = gomod2nix.override { inherit go; }; in - writeScript "${pname}-updater" '' - #!${runtimeShell} + writeShellScript "${attrs.pname or ""}-updater" '' ${optionalString (pwd != null) "cd ${toString pwd}"} - exec ${gomod2nix}/bin/gomod2nix generate ${generatorArgs} + exec ${helper}/bin/gomod2nix generate ${generatorArgs} ''; } // passthru;