-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
initial support for using fetchGit #11
base: master
Are you sure you want to change the base?
Conversation
So, the diff --git a/builder/default.nix b/builder/default.nix
index bfe3298..87d47a5 100644
--- a/builder/default.nix
+++ b/builder/default.nix
@@ -50,9 +50,9 @@ let
sources = builtins.toJSON (lib.mapAttrs
(goPackagePath: meta:
let
- src = fetchgit {
- inherit (meta.fetch) url sha256 rev;
- fetchSubmodules = true;
+ src = builtins.fetchGit {
+ inherit (meta.fetch) url rev;
+ submodules = true;
};
srcPath = "${src}/${meta.relPath or ""}";
in
The next problem I'm having is that my go tests fail (they want to interact with the docker socket, which isn't going to happen with the sandbox enabled). Do you have an idea of what can be done here, aside from disabling tests? If the tests could be built as a binaries and installed in a different output, perhaps testing could be disabled within the build but executed out of band. Having something akin to the above would make Nix a much easier sell to my company, so I'd greatly appreciate any suggestions here. |
Speaking of the tests, maybe the
You'd have to crawl the source tree and do something like I guess that would look something like: for pkg in $(getGoDirs test); do
mkdir -p "$test/$pkg"
buildGoDir test -o "$test/$pkg$(basename pkg).test" -c "$pkg/"*.go
done Completely untested, but I think that gives an idea of what I'm thinking. |
Maybe something like |
Made a couple quick hacks to get the tests built in a outputs = [ "out" "test" ];
checkPhase = attrs.checkPhase or ''
runHook preCheck
for pkg in $(getGoDirs test); do
mkdir -p $test/$pkg
buildGoDir "test -o $test/$pkg/$(go list -f '{{.Name}}' "$pkg" ).test -c" "$pkg"
done
runHook postCheck
'';
preFixup = (attrs.preFixup or "") + ''
find $out/{bin,libexec,lib} -type f 2>/dev/null | xargs -r ${removeExpr removeReferences} || true
find $test -type f 2>/dev/null | xargs -r ${removeExpr removeReferences} || true
''; Works just fine. Tests don't run (so I don't have these changes committed on this branch, because I haven't sorted out how this would best work for all users. I kinda like the idea of one phase to build the test binaries and another (if |
Ah, I just realized we can pass |
Hi, having support for private repositories would be amazing! Anything keeping this from being merged? |
Generating the gomod2nix.toml appears to work, but I haven't tried building with this just yet.
The idea is that this should allow fetching private repositories (see #3).
fetchGit
does not work with short revs, so this:git rev-parse