Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sources to override sources fetcher #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ let
, goPackagePath
, version
, go
, previousSources
}:
let
packageName = "${baseNameOf goPackagePath}_${version}";
in
if hasAttr packageName previousSources then previousSources.${packageName}
else
stdenvNoCC.mkDerivation {
name = "${baseNameOf goPackagePath}_${version}";
name = packageName;
builder = ./fetch.sh;
inherit goPackagePath version;
nativeBuildInputs = [
Expand All @@ -74,6 +80,7 @@ let
, defaultPackage ? ""
, goMod
, pwd
, previousSources
}:
let
localReplaceCommands =
Expand All @@ -96,6 +103,7 @@ let
goPackagePath = meta.replaced or goPackagePath;
inherit (meta) version hash;
inherit go;
inherit previousSources;
})
modulesStruct.mod;
in
Expand Down Expand Up @@ -231,6 +239,8 @@ let
, buildFlags ? ""
, buildFlagsArray ? ""

, sources ? {}

, ...
}@attrs:
let
Expand All @@ -249,6 +259,7 @@ let

vendorEnv = mkVendorEnv {
inherit go modulesStruct defaultPackage goMod pwd;
previousSources = sources;
};

pname = attrs.pname or baseNameOf defaultPackage;
Expand All @@ -264,7 +275,7 @@ let
src = vendorEnv.passthru.sources.${defaultPackage};
} // optionalAttrs (hasAttr "subPackages" modulesStruct) {
subPackages = modulesStruct.subPackages;
} // attrs // {
} // removeAttrs attrs [ "sources" ] // {
nativeBuildInputs = [ rsync go ] ++ nativeBuildInputs;

inherit (go) GOOS GOARCH;
Expand Down