gomod2nix icon indicating copy to clipboard operation
gomod2nix copied to clipboard

Building with a private dependency

Open takeda opened this issue 3 years ago • 3 comments

Not sure if this is a bug, or perhaps it's just advice needed.

I have problem with building a project that contains a private dependency. It appears to be slightly different problem than described in https://github.com/tweag/gomod2nix/issues/3.

After gomod2nix asked me for credentials I just entered it and it did its job, but when I'm trying to build and that dependency came up this is what I got:

exporting https://gitlab.<snip>/<snip>/go-commons (rev 0b8910c77d4eac6c27ef7024e7596bfcfa07feff) into /nix/store/1348m1ip818a03dj49d4ljv5qm14rj7g-go-commons-0b8910c
Initialized empty Git repository in /nix/store/1348m1ip818a03dj49d4ljv5qm14rj7g-go-commons-0b8910c/.git/
fatal: could not read Username for 'https://gitlab.<snip>': Device not configured
fatal: could not read Username for 'https://gitlab.<snip>': Device not configured
fatal: could not read Username for 'https://gitlab.<snip>': Device not configured
Unable to checkout 0b8910c77d4eac6c27ef7024e7596bfcfa07feff from https://gitlab.<snip>/<snip>/go-commons.

Is there a way to let me compile to project? During build I don't even have an opportunity to enter credentials. Of course saved credentials as well like using insteadOf in git configuration don't work.

takeda avatar Mar 27 '22 02:03 takeda

That concept isn't completely clear to me yet, but I'm wondering if: https://github.com/tweag/gomod2nix/blob/master/builder/default.nix#L50-L60 isn't violating IFD. If instead of using and parsing toml, gomod2nix would just generate a nix file that would be simply imported, wouldn't then nix respect local configuration?

takeda avatar Mar 27 '22 04:03 takeda

I've added an override interface in https://github.com/tweag/gomod2nix/pull/42 for dealing with these types of issues. The same interface could also potentially be used to apply patches to individual upstream packages.

adisbladis avatar May 29 '22 20:05 adisbladis

https://github.com/tweag/gomod2nix/pull/55 should help, but it's not a full fix for private dependencies which are generally a bit painful.

adisbladis avatar Jun 13 '22 15:06 adisbladis