From 8d6fbef92a3684d5de4c09535b98d6e93be2f669 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Tue, 23 Apr 2019 16:15:45 +0200 Subject: [PATCH] buildGoModule: support overriding the go-modules derivation --- pkgs/development/go-modules/generic/default.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index cd98aa1fa9a6..55fda78b03e3 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -7,6 +7,9 @@ , passthru ? {} , patches ? [] +# A function to override the go-modules derivation +, overrideModAttrs ? (_oldAttrs : {}) + # modSha256 is the sha256 of the vendored dependencies , modSha256 @@ -27,13 +30,13 @@ with builtins; let - args = removeAttrs args' [ "modSha256" "disabled" ]; + args = removeAttrs args' [ "overrideModAttrs" "modSha256" "disabled" ]; removeReferences = [ ] ++ lib.optional (!allowGoReference) go; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; - go-modules = go.stdenv.mkDerivation { + go-modules = go.stdenv.mkDerivation (let modArgs = { name = "${name}-go-modules"; nativeBuildInputs = [ go git cacert ]; @@ -79,7 +82,7 @@ let outputHashMode = "recursive"; outputHashAlgo = "sha256"; outputHash = modSha256; - }; + }; in modArgs // overrideModAttrs modArgs); package = go.stdenv.mkDerivation (args // { nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;