Using a private git repository with Stack

84 views
Skip to first unread message

Damian Nadales

unread,
Dec 28, 2016, 5:51:01 PM12/28/16
to Commercial Haskell
Hi,

I guess is a situation encountered quite often in practice. However
I'm not sure what is the right way of using a private repository in
stack as the source of Haskell packages. This is how far I've come:
http://stackoverflow.com/questions/41370813/using-a-private-git-repository-with-stack

Which approach do you use?

Thanks in advance!
Damian.

Erik de Castro Lopo

unread,
Jan 2, 2017, 1:35:40 PM1/2/17
to Commercial Haskell
Damian Nadales wrote:

> Which approach do you use?

At Ambiata, we use our own (Open Source) cabal wrapper called mafia:

https://github.com/ambiata/mafia

which does Nix style binary package management as well as handling git
repos as submodules.

I also use it for some of my own stuff and I know of other people not employed
by Ambiata who also use it.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

Damian Nadales

unread,
Jan 5, 2017, 5:17:54 PM1/5/17
to Erik de Castro Lopo, Commercial Haskell
Thanks for the reply Erik.

> At Ambiata, we use our own (Open Source) cabal wrapper called mafia:
>
> https://github.com/ambiata/mafia
>
> which does Nix style binary package management as well as handling git
> repos as submodules.
>
Does this complement with Stack, or is it an alternative to it?

> I also use it for some of my own stuff and I know of other people not employed
> by Ambiata who also use it.
>
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
>
> --
> You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to commercialhask...@googlegroups.com.
> To post to this group, send email to commerci...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/20170103053535.000472e9e5fd2d9efd7c9eeb%40mega-nerd.com.
> For more options, visit https://groups.google.com/d/optout.

Erik de Castro Lopo

unread,
Jan 6, 2017, 2:38:21 AM1/6/17
to Commercial Haskell
Damian Nadales wrote:

> Does this complement with Stack, or is it an alternative to it?

Its an alternative to Stack.

Christopher Allen

unread,
Jan 6, 2017, 2:40:42 AM1/6/17
to Damian Nadales, Commercial Haskell
I use Stack with private git repos. If your git configuration is
correct (I never do anything manual, it's just ssh keypairs) then it
should work out of the box.
> --
> You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to commercialhask...@googlegroups.com.
> To post to this group, send email to commerci...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/CAM7nXedTsWdQX0U8onuO%2BqMEkc2OBOzw%2BZ5Mo_S_ek2-HuvtJg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Chris Allen
Currently working on http://haskellbook.com

Damian Nadales

unread,
Jan 6, 2017, 2:55:34 AM1/6/17
to Christopher Allen, Commercial Haskell


On Jan 6, 2017 08:40, "Christopher Allen" <c...@bitemyapp.com> wrote:
I use Stack with private git repos. If your git configuration is
correct (I never do anything manual, it's just ssh keypairs) then it
should work out of the box.
It does. I did a small experiment and it works perfectly. The only thing I don't like is that I need to specify the commit in my stack.yml:

This means that updating the package requires updating the commit id at the stack file. 

I don't know if you refer to this approach. 


On Wed, Dec 28, 2016 at 4:50 PM, Damian Nadales
<damian....@gmail.com> wrote:
> Hi,
>
> I guess is a situation encountered quite often in practice. However
> I'm not sure what is the right way of using a private repository in
> stack as the source of Haskell packages. This is how far I've come:
>     http://stackoverflow.com/questions/41370813/using-a-private-git-repository-with-stack
>
> Which approach do you use?
>
> Thanks in advance!
> Damian.
>
> --
> You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to commercialhaskell+unsubscribe@googlegroups.com.
> To post to this group, send email to commercialhaskell@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commercialhaskell+unsubscribe@googlegroups.com.
To post to this group, send email to commercialhaskell@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/CADnndOq_jgdDo8vh3O1_kj%2BU_j68ZxfgJfVOSsVYbmWNvFEboQ%40mail.gmail.com.

Christopher Allen

unread,
Jan 6, 2017, 3:11:39 AM1/6/17
to Damian Nadales, Commercial Haskell
That's absolutely what we want and is representative of the point of
Stack: deterministic, reproducible builds.

Anything that should have changes tracked collectively (if B uses A,
and B should always use the latest version of A), then it implies it
should be part of a monorepo. Which is what we do for those
components.

Here's a snippet from our stack.yaml:

resolver: lts-6.8
packages:
- hestia/
- thoth/
- friendlyId/
- rosetta/
- location:
git: https://github.com/mwotton/mandrill
commit: fd22b874feb76fbb76911b6049b4a89f181857d8
extra-dep: true

Here mandrill is a fork of a repo. We don't want to this to change
unless we explicitly upgrade.

hestia, thoth, friendlyId, and rosetta are all part of the same repo
because they "belong together."

Does that help?
>> email to commercialhask...@googlegroups.com.
>> To post to this group, send email to commerci...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/commercialhaskell/CAM7nXedTsWdQX0U8onuO%2BqMEkc2OBOzw%2BZ5Mo_S_ek2-HuvtJg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Chris Allen
> Currently working on http://haskellbook.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to commercialhask...@googlegroups.com.
> To post to this group, send email to commerci...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to commercialhask...@googlegroups.com.
> To post to this group, send email to commerci...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/commercialhaskell/CAM7nXecHkFpHhWpD2157%3Df_Hju4RtZBEE9pjoNgL9dZx88C1wQ%40mail.gmail.com.

Erik Hesselink

unread,
Jan 6, 2017, 6:21:19 AM1/6/17
to Christopher Allen, Damian Nadales, Commercial Haskell
Another option that falls in between a monorepo and a git dependency is using git submodules. We did this for forks and open sourced libraries. You still need to point to a commit hash (since that's how submodules work) but as mentioned that's a good idea anyway. We then listed those submodule packages as 'extra-dep: true' to not have them treated as part of our own sources.

The stack.yaml would look something like this:

packages:
- local-package-1/
- local-package-2/
- location: forks/submodule-for-fork/
  extra-dep: true

Erik

P.S. Resending with a different 'from' address since it bounced, Christopher/Damian, sorry for the spam.

>> email to commercialhaskell+unsubscribe@googlegroups.com.
>> To post to this group, send email to commercialhaskell@googlegroups.com.

>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/commercialhaskell/CAM7nXedTsWdQX0U8onuO%2BqMEkc2OBOzw%2BZ5Mo_S_ek2-HuvtJg%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Chris Allen
> Currently working on http://haskellbook.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to commercialhaskell+unsubscribe@googlegroups.com.
> To post to this group, send email to commercialhaskell@googlegroups.com.

> To view this discussion on the web visit
> https://groups.google.com/d/msgid/commercialhaskell/CADnndOq_jgdDo8vh3O1_kj%2BU_j68ZxfgJfVOSsVYbmWNvFEboQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to commercialhaskell+unsubscribe@googlegroups.com.
> To post to this group, send email to commercialhaskell@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Commercial Haskell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commercialhaskell+unsubscribe@googlegroups.com.
To post to this group, send email to commercialhaskell@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/CADnndOrF7LakVAXKcNvXxc63subMt3G2qVGjDAutqg75dD_Bbg%40mail.gmail.com.

Noon van der Silk

unread,
Jan 6, 2017, 10:50:10 PM1/6/17
to Damian Nadales, Christopher Allen, Commercial Haskell
This means that updating the package requires updating the commit 
> id at the stack file. 

Note that you can just set the `commit` to be `master`, if you'd like (from your SO question):

packages:
- '.'
- location:
    git: ssh://git@urlprivate-git-repo.com:7999/project/subproject.git
    commit: master
  subdirs:
  - subdir-of-the-private-package
  extra-dep: true

--
Noon




For more options, visit https://groups.google.com/d/optout.



--
Noon Silk, ن

https://silky.github.io/

"Every morning when I wake up, I experience an exquisite joy — the joy
of being this signature."

Damian Nadales

unread,
Jan 8, 2017, 3:57:28 PM1/8/17
to Noon van der Silk, Christopher Allen, Commercial Haskell
> Note that you can just set the `commit` to be `master`, if you'd like (from
> your SO question):
>
Oh, nice one. I overlooked that! Thanks.

> packages:
> - '.'
> - location:
> git: ssh://g...@urlprivate-git-repo.com:7999/project/subproject.git
>> > an email to commercialhask...@googlegroups.com.
>> > To post to this group, send email to commerci...@googlegroups.com.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/commercialhaskell/CAM7nXedTsWdQX0U8onuO%2BqMEkc2OBOzw%2BZ5Mo_S_ek2-HuvtJg%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Chris Allen
>> Currently working on http://haskellbook.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Commercial Haskell" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to commercialhask...@googlegroups.com.
>> To post to this group, send email to commerci...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/commercialhaskell/CADnndOq_jgdDo8vh3O1_kj%2BU_j68ZxfgJfVOSsVYbmWNvFEboQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Commercial Haskell" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to commercialhask...@googlegroups.com.
>> To post to this group, send email to commerci...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/commercialhaskell/CAM7nXecHkFpHhWpD2157%3Df_Hju4RtZBEE9pjoNgL9dZx88C1wQ%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Noon Silk, ن
>
> https://silky.github.io/
>
> "Every morning when I wake up, I experience an exquisite joy — the joy
> of being this signature."
>
> --
> You received this message because you are subscribed to the Google Groups
> "Commercial Haskell" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to commercialhask...@googlegroups.com.
> To post to this group, send email to commerci...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/commercialhaskell/CADt_azaiwj49jdWbtbXYmqhrLEiiz9Fes-9zeTGLb1V4zjMpuQ%40mail.gmail.com.

Damian Nadales

unread,
Jan 8, 2017, 4:01:40 PM1/8/17
to Christopher Allen, Commercial Haskell
> Anything that should have changes tracked collectively (if B uses A,
> and B should always use the latest version of A), then it implies it
> should be part of a monorepo. Which is what we do for those
> components.
>
> Here's a snippet from our stack.yaml:
>
> resolver: lts-6.8
> packages:
> - hestia/
> - thoth/
> - friendlyId/
> - rosetta/
> - location:
> git: https://github.com/mwotton/mandrill
> commit: fd22b874feb76fbb76911b6049b4a89f181857d8
> extra-dep: true
>
> Here mandrill is a fork of a repo. We don't want to this to change
> unless we explicitly upgrade.
>
> hestia, thoth, friendlyId, and rosetta are all part of the same repo
> because they "belong together."
>
> Does that help?
>
It does. For now I'm just experimenting a bit, preparing the ground in
case the opportunity pops up to implement a micro-service in Haskell.

You said that hestia, thoth, friendlyId, and rosetta belong together.
But what if you needed to use these libraries in some other repo.
Would you go for the git-submodules approach?
> To view this discussion on the web visit https://groups.google.com/d/msgid/commercialhaskell/CADnndOrF7LakVAXKcNvXxc63subMt3G2qVGjDAutqg75dD_Bbg%40mail.gmail.com.

Damian Nadales

unread,
Jan 8, 2017, 4:04:06 PM1/8/17
to Erik Hesselink, Christopher Allen, Commercial Haskell
On Fri, Jan 6, 2017 at 11:59 AM, Erik Hesselink <hess...@gmail.com> wrote:
> Another option that falls in between a monorepo and a git dependency is
> using git submodules. We did this for forks and open sourced libraries. You
> still need to point to a commit hash (since that's how submodules work) but
> as mentioned that's a good idea anyway. We then listed those submodule
> packages as 'extra-dep: true' to not have them treated as part of our own
> sources.
>
That also looks like a simple solution. How does this approach works
for you in practice? I've heard people advising against the use of
git-submodules (we don't use them currently).

> The stack.yaml would look something like this:
>
> packages:
> - local-package-1/
> - local-package-2/
> - location: forks/submodule-for-fork/
> extra-dep: true
>
> Erik
>
> Erik
>
>
> On 6 January 2017 at 09:11, Christopher Allen <c...@bitemyapp.com> wrote:
>>
>> https://groups.google.com/d/msgid/commercialhaskell/CADnndOrF7LakVAXKcNvXxc63subMt3G2qVGjDAutqg75dD_Bbg%40mail.gmail.com.

Erik Hesselink

unread,
Jan 9, 2017, 5:52:38 AM1/9/17
to Damian Nadales, Christopher Allen, Commercial Haskell
On 8 January 2017 at 22:03, Damian Nadales <damian....@gmail.com> wrote:
On Fri, Jan 6, 2017 at 11:59 AM, Erik Hesselink <hess...@gmail.com> wrote:
> Another option that falls in between a monorepo and a git dependency is
> using git submodules. We did this for forks and open sourced libraries. You
> still need to point to a commit hash (since that's how submodules work) but
> as mentioned that's a good idea anyway. We then listed those submodule
> packages as 'extra-dep: true' to not have them treated as part of our own
> sources.
>
That also looks like a simple solution. How does this approach works
for you in practice? I've heard people advising against the use of
git-submodules (we don't use them currently).

We've used it ever since we switched to stack about 1.5 years ago, and we've used submodules for about 7 years, so I'd say it works. Submodules are not great (biggest problem is that a pull doesn't update them, so you can accidentally commit a revert of the updated submodule) but they work. If you have things you often want to branch together, I'd put them in the same repo (we do for our normal libraries and apps) but loosely related things like forks of dependencies work well as submodules.

Erik
 
 

>> >> To post to this group, send email to

>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/commercialhaskell/CAM7nXedTsWdQX0U8onuO%2BqMEkc2OBOzw%2BZ5Mo_S_ek2-HuvtJg%40mail.gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> >
>> > --
>> > Chris Allen
>> > Currently working on http://haskellbook.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Commercial Haskell" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to commercialhaskell+unsubscribe@googlegroups.com.
>> > To post to this group, send email to commercialhaskell@googlegroups.com.

>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/commercialhaskell/CADnndOq_jgdDo8vh3O1_kj%2BU_j68ZxfgJfVOSsVYbmWNvFEboQ%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Commercial Haskell" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to commercialhaskell+unsubscribe@googlegroups.com.
>> > To post to this group, send email to commercialhaskell@googlegroups.com.

>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/commercialhaskell/CAM7nXecHkFpHhWpD2157%3Df_Hju4RtZBEE9pjoNgL9dZx88C1wQ%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Chris Allen
>> Currently working on http://haskellbook.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Commercial Haskell" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to commercialhaskell+unsubscribe@googlegroups.com.
>> To post to this group, send email to commercialhaskell@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages