go builder: use removeReferencesTo
This commit is contained in:
parent
eb70ae34b1
commit
4a12a681ef
@ -1,4 +1,4 @@
|
|||||||
{ go, govers, parallel, lib, fetchgit, fetchhg, rsync }:
|
{ go, govers, parallel, lib, fetchgit, fetchhg, rsync, removeReferencesTo }:
|
||||||
|
|
||||||
{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""
|
{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? ""
|
||||||
|
|
||||||
@ -41,9 +41,7 @@ let
|
|||||||
|
|
||||||
removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
|
removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
|
||||||
|
|
||||||
removeExpr = refs: lib.flip lib.concatMapStrings refs (ref: ''
|
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
|
||||||
| sed "s,${ref},$(echo "${ref}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" \
|
|
||||||
'');
|
|
||||||
|
|
||||||
dep2src = goDep:
|
dep2src = goDep:
|
||||||
{
|
{
|
||||||
@ -70,7 +68,7 @@ go.stdenv.mkDerivation (
|
|||||||
(builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
|
(builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
|
||||||
|
|
||||||
inherit name;
|
inherit name;
|
||||||
nativeBuildInputs = [ go parallel ]
|
nativeBuildInputs = [ removeReferencesTo go parallel ]
|
||||||
++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;
|
++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;
|
||||||
buildInputs = [ go ] ++ buildInputs;
|
buildInputs = [ go ] ++ buildInputs;
|
||||||
|
|
||||||
@ -186,11 +184,7 @@ go.stdenv.mkDerivation (
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = preFixup + ''
|
preFixup = preFixup + ''
|
||||||
while read file; do
|
find $bin/bin -type f -exec ${removeExpr removeReferences} '{}' +
|
||||||
cat $file ${removeExpr removeReferences} > $file.tmp
|
|
||||||
mv $file.tmp $file
|
|
||||||
chmod +x $file
|
|
||||||
done < <(find $bin/bin -type f 2>/dev/null)
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user