Skip to content
Closed
Show file tree
Hide file tree
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
65 changes: 26 additions & 39 deletions doc/languages-frameworks/go.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ deis = buildGoPackage rec {
sha256 = "1qv9lxqx7m18029lj8cw3k7jngvxs4iciwrypdy0gd2nnghc68sw";
};

goDeps = ./deps.json; <co xml:id='ex-buildGoPackage-3' />
goDeps = import ./deps.nix { inherit fetchgit; }; <co xml:id='ex-buildGoPackage-3' />

buildFlags = "--tags release"; <co xml:id='ex-buildGoPackage-4' />
}
Expand Down Expand Up @@ -56,7 +56,9 @@ the following arguments are of special significance to the function:
<callout arearefs='ex-buildGoPackage-3'>
<para>
<varname>goDeps</varname> is where the Go dependencies of a Go program are listed
in a JSON format described below.
as a list of package source identified by Go import path.
It could be imported as a separate <varname>deps.nix</varname> file for
readability. Dependency format is described below.
</para>
</callout>

Expand All @@ -70,30 +72,31 @@ the following arguments are of special significance to the function:

</para>

<para>The <varname>goDeps</varname> attribute should point to a JSON file that defines which Go libraries
are needed and should be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.

<para>The <varname>goDeps</varname> attribute can be imported from a separate
<varname>nix</varname> file that defines which Go libraries are needed and should
be included in <varname>GOPATH</varname> for <varname>buildPhase</varname>.
</para>

<example xml:id='ex-goDeps'><title>deps.json</title>
<example xml:id='ex-goDeps'><title>deps.nix</title>
<programlisting>
{ fetchgit }:
[ <co xml:id='ex-goDeps-1' />
{
"goPackagePath": "gopkg.in/yaml.v2", <co xml:id='ex-goDeps-2' />
"fetch": {
"type": "git", <co xml:id='ex-goDeps-3' />
"url": "https://gopkg.in/yaml.v2",
"rev": "a83829b6f1293c91addabc89d0571c246397bbf4",
"sha256": "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh"
}
},
{
"include": "../../libs.json", <co xml:id='ex-goDeps-4' />
"packages": [ <co xml:id='ex-goDeps-5' />
"github.com/docopt/docopt-go",
"golang.org/x/crypto",
]
}
{
goPackagePath = "gopkg.in/yaml.v2"; <co xml:id='ex-goDeps-2' />
src = fetchgit { <co xml:id='ex-goDeps-3' />
url = "https://gopkg.in/yaml.v2";
rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
};
}
{
goPackagePath = "github.com/docopt/docopt-go";
src = fetchgit {
url = "https://github.com/docopt/docopt-go";
rev = "784ddc588536785e7299f7272f39101f7faccc3f";
sha256 = "0wwz48jl9fvl1iknvn9dqr4gfy1qs03gxaikrxxp9gry6773v3sj";
};
}
]
</programlisting>
</example>
Expand All @@ -116,23 +119,7 @@ the following arguments are of special significance to the function:

<callout arearefs='ex-goDeps-3'>
<para>
<varname>fetch type</varname> that needs to be used to get package source. If <varname>git</varname>
is used there should be <varname>url</varname>, <varname>rev</varname> and <varname>sha256</varname>
defined next to it.
</para>
</callout>

<callout arearefs='ex-goDeps-4'>
<para>
<varname>include</varname> could be used to reuse <varname>goDeps</varname> between Go programs.
There is a common libs set in <varname>&lt;nixpkgs/pkgs/development/go-modules/libs.json&gt;</varname>
with pinned versions of many packages that you can reuse.
</para>
</callout>

<callout arearefs='ex-goDeps-5'>
<para>
<varname>packages</varname> enumerates all Go packages that will be imported from included file.
<varname>src</varname> defines Go packagee source.
</para>
</callout>

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/misc/hugo/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub }:
{ stdenv, buildGoPackage, fetchFromGitHub, fetchgit }:

buildGoPackage rec {
name = "hugo-${version}";
Expand All @@ -14,5 +14,5 @@ buildGoPackage rec {
sha256 = "135mrdi8i56z9m2sihjrdfab6lrczbfgavwvfrngvi1zxnx7scmv";
};

goDeps = ./deps.json;
goDeps = import ./deps.nix { inherit fetchgit; };
}
44 changes: 0 additions & 44 deletions pkgs/applications/misc/hugo/deps.json

This file was deleted.

Loading