Skip to content

Commit

Permalink
buildGoModule: support overriding the go-modules derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
basvandijk committed Apr 23, 2019
1 parent 029a37c commit c93e5ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkgs/development/go-modules/generic/default.nix
Expand Up @@ -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

Expand All @@ -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 ];
Expand Down Expand Up @@ -78,7 +81,7 @@ let
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = modSha256;
};
}; in modArgs // overrideModAttrs modArgs);

package = go.stdenv.mkDerivation (args // {
nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;
Expand Down

0 comments on commit c93e5ca

Please sign in to comment.