Merge pull request #57080 from kalbasit/nixpkgs_create-build-go-module

buildGoModule: building Go binaries in two phases
This commit is contained in:
Wael Nasreddine 2019-03-14 15:12:51 -07:00 committed by GitHub
commit a0e4f44006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 659 additions and 5126 deletions

View File

@ -3,12 +3,91 @@
xml:id="sec-language-go">
<title>Go</title>
<para>
The function <varname>buildGoPackage</varname> builds standard Go programs.
</para>
<section xml:id="ssec-go-modules">
<title>Go modules</title>
<example xml:id='ex-buildGoPackage'>
<title>buildGoPackage</title>
<para>
The function <varname> buildGoModule </varname> builds Go programs managed
with Go modules. It builds a
<link xlink:href="https://github.com/golang/go/wiki/Modules">Go
modules</link> through a two phase build:
<itemizedlist>
<listitem>
<para>
An intermediate fetcher derivation. This derivation will be used to fetch
all of the dependencies of the Go module.
</para>
</listitem>
<listitem>
<para>
A final derivation will use the output of the intermediate derivation to
build the binaries and produce the final output.
</para>
</listitem>
</itemizedlist>
</para>
<example xml:id='ex-buildGoModule'>
<title>buildGoModule</title>
<programlisting>
pet = buildGoModule rec {
name = "pet-${version}";
version = "0.3.4";
src = fetchFromGitHub {
owner = "knqyf263";
repo = "pet";
rev = "v${version}";
sha256 = "0m2fzpqxk7hrbxsgqplkg7h2p7gv6s1miymv3gvw0cz039skag0s";
};
modSha256 = "1879j77k96684wi554rkjxydrj8g3hpp0kvxz03sd8dmwr3lh83j"; <co xml:id='ex-buildGoModule-1' />
subPackages = [ "." ]; <co xml:id='ex-buildGoModule-2' />
meta = with lib; {
description = "Simple command-line snippet manager, written in Go";
homepage = https://github.com/knqyf263/pet;
license = licenses.mit;
maintainers = with maintainers; [ kalbasit ];
platforms = platforms.linux ++ platforms.darwin;
};
}
</programlisting>
</example>
<para>
<xref linkend='ex-buildGoModule'/> is an example expression using
buildGoModule, the following arguments are of special significance to the
function:
<calloutlist>
<callout arearefs='ex-buildGoModule-1'>
<para>
<varname>modSha256</varname> is the hash of the output of the
intermediate fetcher derivation.
</para>
</callout>
<callout arearefs='ex-buildGoModule-2'>
<para>
<varname>subPackages</varname> limits the builder from building child
packages that have not been listed. If <varname>subPackages</varname> is
not specified, all child packages will be built.
</para>
</callout>
</calloutlist>
</para>
</section>
<section xml:id="ssec-go-legacy">
<title>Go legacy</title>
<para>
The function <varname> buildGoPackage </varname> builds legacy Go programs,
not supporting Go modules.
</para>
<example xml:id='ex-buildGoPackage'>
<title>buildGoPackage</title>
<programlisting>
deis = buildGoPackage rec {
name = "deis-${version}";
@ -29,56 +108,56 @@ deis = buildGoPackage rec {
buildFlags = "--tags release"; <co xml:id='ex-buildGoPackage-4' />
}
</programlisting>
</example>
</example>
<para>
<xref linkend='ex-buildGoPackage'/> is an example expression using
buildGoPackage, the following arguments are of special significance to the
function:
<calloutlist>
<callout arearefs='ex-buildGoPackage-1'>
<para>
<varname>goPackagePath</varname> specifies the package's canonical Go
import path.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-2'>
<para>
<varname>subPackages</varname> limits the builder from building child
packages that have not been listed. If <varname>subPackages</varname> is
not specified, all child packages will be built.
</para>
<para>
In this example only <literal>github.com/deis/deis/client</literal> will
be built.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-3'>
<para>
<varname>goDeps</varname> is where the Go dependencies of a Go program are
listed 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. The dependency data structure is described below.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-4'>
<para>
<varname>buildFlags</varname> is a list of flags passed to the go build
command.
</para>
</callout>
</calloutlist>
</para>
<para>
<xref linkend='ex-buildGoPackage'/> is an example expression using
buildGoPackage, the following arguments are of special significance to the
function:
<calloutlist>
<callout arearefs='ex-buildGoPackage-1'>
<para>
<varname>goPackagePath</varname> specifies the package's canonical Go
import path.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-2'>
<para>
<varname>subPackages</varname> limits the builder from building child
packages that have not been listed. If <varname>subPackages</varname> is
not specified, all child packages will be built.
</para>
<para>
In this example only <literal>github.com/deis/deis/client</literal> will
be built.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-3'>
<para>
<varname>goDeps</varname> is where the Go dependencies of a Go program
are listed 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. The dependency data structure is described below.
</para>
</callout>
<callout arearefs='ex-buildGoPackage-4'>
<para>
<varname>buildFlags</varname> is a list of flags passed to the go build
command.
</para>
</callout>
</calloutlist>
</para>
<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>
<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.nix</title>
<example xml:id='ex-goDeps'>
<title>deps.nix</title>
<programlisting>
[ <co xml:id='ex-goDeps-1' />
{
@ -101,60 +180,62 @@ deis = buildGoPackage rec {
}
]
</programlisting>
</example>
</example>
<para>
<calloutlist>
<callout arearefs='ex-goDeps-1'>
<para>
<varname>goDeps</varname> is a list of Go dependencies.
</para>
</callout>
<callout arearefs='ex-goDeps-2'>
<para>
<varname>goPackagePath</varname> specifies Go package import path.
</para>
</callout>
<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>
</calloutlist>
</para>
<para>
<calloutlist>
<callout arearefs='ex-goDeps-1'>
<para>
<varname>goDeps</varname> is a list of Go dependencies.
</para>
</callout>
<callout arearefs='ex-goDeps-2'>
<para>
<varname>goPackagePath</varname> specifies Go package import path.
</para>
</callout>
<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>
</calloutlist>
</para>
<para>
To extract dependency information from a Go package in automated way use
<link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>. It can
produce complete derivation and <varname>goDeps</varname> file for Go
programs.
</para>
<para>
To extract dependency information from a Go package in automated way use
<link xlink:href="https://github.com/kamilchm/go2nix">go2nix</link>. It can
produce complete derivation and <varname>goDeps</varname> file for Go
programs.
</para>
<para>
<varname>buildGoPackage</varname> produces
<xref linkend='chap-multiple-output' xrefstyle="select: title" /> where
<varname>bin</varname> includes program binaries. You can test build a Go
binary as follows:
<para>
<varname>buildGoPackage</varname> produces
<xref linkend='chap-multiple-output' xrefstyle="select: title" /> where
<varname>bin</varname> includes program binaries. You can test build a Go
binary as follows:
<screen>
$ nix-build -A deis.bin
</screen>
or build all outputs with:
or build all outputs with:
<screen>
$ nix-build -A deis.all
</screen>
<varname>bin</varname> output will be installed by default with
<varname>nix-env -i</varname> or <varname>systemPackages</varname>.
</para>
<varname>bin</varname> output will be installed by default with
<varname>nix-env -i</varname> or <varname>systemPackages</varname>.
</para>
<para>
You may use Go packages installed into the active Nix profiles by adding the
following to your ~/.bashrc:
<para>
You may use Go packages installed into the active Nix profiles by adding the
following to your ~/.bashrc:
<screen>
for p in $NIX_PROFILES; do
GOPATH="$p/share/go:$GOPATH"
done
</screen>
</para>
</para>
</section>
</section>

View File

@ -1,6 +1,6 @@
{ stdenv, buildGoPackage, fetchFromGitHub }:
{ stdenv, buildGoModule, fetchFromGitHub }:
buildGoPackage rec {
buildGoModule rec {
name = "hugo-${version}";
version = "0.54.0";
@ -13,13 +13,11 @@ buildGoPackage rec {
sha256 = "01grfbr3kpd4qf5cbcmzc6yfq34cm0nkak4pqzgrn46r254y0ymv";
};
goDeps = ./deps.nix;
modSha256 = "0fqmxmhbzkd5617gch836l7clqbxx8b1mxx09v3v2c4jjxcm85cm";
buildFlags = "-tags extended";
postInstall = ''
rm $bin/bin/generate
'';
subPackages = [ "." ];
meta = with stdenv.lib; {
description = "A fast and modern static website engine.";

View File

@ -1,777 +0,0 @@
# file generated from go.mod using vgo2nix (https://github.com/adisbladis/vgo2nix)
[
{
goPackagePath = "github.com/gobuffalo/envy";
fetch = {
type = "git";
url = "https://github.com/gobuffalo/envy";
rev = "v1.6.8";
"sha256" = "1xh26j9bji8c4hr05f89kbc4fhqniba00bdcic4gs5xfnp2vj7gk";
};
}
{
goPackagePath = "github.com/joho/godotenv";
fetch = {
type = "git";
url = "https://github.com/joho/godotenv";
rev = "v1.3.0";
"sha256" = "0ri8if0pc3x6jg4c3i8wr58xyfpxkwmcjk3rp8gb398a1aa3gpjm";
};
}
{
goPackagePath = "github.com/BurntSushi/locker";
fetch = {
type = "git";
url = "https://github.com/BurntSushi/locker";
rev = "a6e239ea1c69";
sha256 = "1xak4aync4klswq5217qvw191asgla51jr42y94vp109lirm5dzg";
};
}
{
goPackagePath = "github.com/BurntSushi/toml";
fetch = {
type = "git";
url = "https://github.com/BurntSushi/toml";
rev = "a368813c5e64";
sha256 = "1sjxs2lwc8jpln80s4rlzp7nprbcljhy5mz4rf9995gq93wqnym5";
};
}
{
goPackagePath = "github.com/PuerkitoBio/purell";
fetch = {
type = "git";
url = "https://github.com/PuerkitoBio/purell";
rev = "v1.1.0";
sha256 = "0vsxyn1fbm7g873b8kf3hcsgqgncb5nmfq3zfsc35a9yhzarka91";
};
}
{
goPackagePath = "github.com/PuerkitoBio/urlesc";
fetch = {
type = "git";
url = "https://github.com/PuerkitoBio/urlesc";
rev = "de5bf2ad4578";
sha256 = "0n0srpqwbaan1wrhh2b7ysz543pjs1xw2rghvqyffg9l0g8kzgcw";
};
}
{
goPackagePath = "github.com/alecthomas/assert";
fetch = {
type = "git";
url = "https://github.com/alecthomas/assert";
rev = "405dbfeb8e38";
sha256 = "1l567pi17k593nrd1qlbmiq8z9jy3qs60px2a16fdpzjsizwqx8l";
};
}
{
goPackagePath = "github.com/alecthomas/chroma";
fetch = {
type = "git";
url = "https://github.com/alecthomas/chroma";
rev = "v0.6.2";
sha256 = "1bcppy1s148iikr78qjm0akahn01ywh83a8pw544prr9yc16jvmz";
};
}
{
goPackagePath = "github.com/alecthomas/colour";
fetch = {
type = "git";
url = "https://github.com/alecthomas/colour";
rev = "60882d9e2721";
sha256 = "0iq566534gbzkd16ixg7fk298wd766821vvs80838yifx9yml5vs";
};
}
{
goPackagePath = "github.com/alecthomas/kong";
fetch = {
type = "git";
url = "https://github.com/alecthomas/kong";
rev = "v0.1.15";
sha256 = "1llxabcdzlb2hard0h931knqkdnyjyz8dp3k0nli0m0mags7l31b";
};
}
{
goPackagePath = "github.com/alecthomas/repr";
fetch = {
type = "git";
url = "https://github.com/alecthomas/repr";
rev = "d37bc2a10ba1";
sha256 = "0jnx1ypdl4zi010ds2z857ajkr5cx51wkx950rfqb126hvql7svx";
};
}
{
goPackagePath = "github.com/armon/consul-api";
fetch = {
type = "git";
url = "https://github.com/armon/consul-api";
rev = "eb2c6b5be1b6";
sha256 = "1j6fdr1sg36qy4n4xjl7brq739fpm5npq98cmvklzjc9qrx98nk9";
};
}
{
goPackagePath = "github.com/bep/debounce";
fetch = {
type = "git";
url = "https://github.com/bep/debounce";
rev = "v1.1.0";
sha256 = "1sh4zv0hv7f454mhzpl2mbv7ar5rm00wyy5qr78x1h84bgph87wy";
};
}
{
goPackagePath = "github.com/bep/gitmap";
fetch = {
type = "git";
url = "https://github.com/bep/gitmap";
rev = "v1.0.0";
sha256 = "0zqdl5h4ayi2gi5aqf35f1sjszhbcriksm2bf84fkrg7ngr48jn6";
};
}
{
goPackagePath = "github.com/bep/go-tocss";
fetch = {
type = "git";
url = "https://github.com/bep/go-tocss";
rev = "v0.6.0";
sha256 = "0w5i3ig3bbdrwbrcwzx8xsxhlb8xr17jj3wdcb6klqglg7551yvm";
};
}
{
goPackagePath = "github.com/chaseadamsio/goorgeous";
fetch = {
type = "git";
url = "https://github.com/chaseadamsio/goorgeous";
rev = "v1.1.0";
sha256 = "07qdqi46klizq3wigxqbiksnlgbrdc8hvmizgzg0aas5iqy88dcb";
};
}
{
goPackagePath = "github.com/cheekybits/is";
fetch = {
type = "git";
url = "https://github.com/cheekybits/is";
rev = "68e9c0620927";
sha256 = "1mkbyzhwq3rby832ikq00nxv3jnckxsm3949wkxd8ya9js2jmg4d";
};
}
{
goPackagePath = "github.com/coreos/etcd";
fetch = {
type = "git";
url = "https://github.com/coreos/etcd";
rev = "v3.3.10";
sha256 = "1x2ii1hj8jraba8rbxz6dmc03y3sjxdnzipdvg6fywnlq1f3l3wl";
};
}
{
goPackagePath = "github.com/coreos/go-etcd";
fetch = {
type = "git";
url = "https://github.com/coreos/go-etcd";
rev = "v2.0.0";
sha256 = "1xb34hzaa1lkbq5vkzy9vcz6gqwj7hp6cdbvyack2bf28dwn33jj";
};
}
{
goPackagePath = "github.com/coreos/go-semver";
fetch = {
type = "git";
url = "https://github.com/coreos/go-semver";
rev = "v0.2.0";
sha256 = "1gghi5bnqj50hfxhqc1cxmynqmh2yk9ii7ab9gsm75y5cp94ymk0";
};
}
{
goPackagePath = "github.com/cpuguy83/go-md2man";
fetch = {
type = "git";
url = "https://github.com/cpuguy83/go-md2man";
rev = "v1.0.8";
sha256 = "1w22dfdamsq63b5rvalh9k2y7rbwfkkjs7vm9vd4a13h2ql70lg2";
};
}
{
goPackagePath = "github.com/danwakefield/fnmatch";
fetch = {
type = "git";
url = "https://github.com/danwakefield/fnmatch";
rev = "cbb64ac3d964";
sha256 = "0cbf511ppsa6hf59mdl7nbyn2b2n71y0bpkzbmfkdqjhanqh1lqz";
};
}
{
goPackagePath = "github.com/davecgh/go-spew";
fetch = {
type = "git";
url = "https://github.com/davecgh/go-spew";
rev = "v1.1.1";
sha256 = "0hka6hmyvp701adzag2g26cxdj47g21x6jz4sc6jjz1mn59d474y";
};
}
{
goPackagePath = "github.com/disintegration/imaging";
fetch = {
type = "git";
url = "https://github.com/disintegration/imaging";
rev = "v1.5.0";
sha256 = "1laxccmzi7q51zxn81ringmdwp8iaipivrl375yc3gq56d70sp0r";
};
}
{
goPackagePath = "github.com/dlclark/regexp2";
fetch = {
type = "git";
url = "https://github.com/dlclark/regexp2";
rev = "v1.1.6";
sha256 = "144s81ndviwhyy20ipxvvfvap8phv5p762glxrz6aqxprkxfarj5";
};
}
{
goPackagePath = "github.com/dustin/go-humanize";
fetch = {
type = "git";
url = "https://github.com/dustin/go-humanize";
rev = "v1.0.0";
sha256 = "1kqf1kavdyvjk7f8kx62pnm7fbypn9z1vbf8v2qdh3y7z7a0cbl3";
};
}
{
goPackagePath = "github.com/eknkc/amber";
fetch = {
type = "git";
url = "https://github.com/eknkc/amber";
rev = "cdade1c07385";
sha256 = "152w97yckwncgw7lwjvgd8d00wy6y0nxzlvx72kl7nqqxs9vhxd9";
};
}
{
goPackagePath = "github.com/fortytw2/leaktest";
fetch = {
type = "git";
url = "https://github.com/fortytw2/leaktest";
rev = "v1.2.0";
sha256 = "1lf9l6zgzjbcc7hmcjhhg3blx0y8icyxvjmjqqwfbwdk502803ra";
};
}
{
goPackagePath = "github.com/fsnotify/fsnotify";
fetch = {
type = "git";
url = "https://github.com/fsnotify/fsnotify";
rev = "v1.4.7";
sha256 = "07va9crci0ijlivbb7q57d2rz9h27zgn2fsm60spjsqpdbvyrx4g";
};
}
{
goPackagePath = "github.com/gobwas/glob";
fetch = {
type = "git";
url = "https://github.com/gobwas/glob";
rev = "v0.2.3";
sha256 = "0jxk1x806zn5x86342s72dq2qy64ksb3zrvrlgir2avjhwb18n6z";
};
}
{
goPackagePath = "github.com/gorilla/websocket";
fetch = {
type = "git";
url = "https://github.com/gorilla/websocket";
rev = "v1.4.0";
sha256 = "00i4vb31nsfkzzk7swvx3i75r2d960js3dri1875vypk3v2s0pzk";
};
}
{
goPackagePath = "github.com/hashicorp/go-immutable-radix";
fetch = {
type = "git";
url = "https://github.com/hashicorp/go-immutable-radix";
rev = "v1.0.0";
sha256 = "1v3nmsnk1s8bzpclrhirz7iq0g5xxbw9q5gvrg9ss6w9crs72qr6";
};
}
{
goPackagePath = "github.com/hashicorp/go-uuid";
fetch = {
type = "git";
url = "https://github.com/hashicorp/go-uuid";
rev = "v1.0.0";
sha256 = "1jflywlani7583qm4ysph40hsgx3n66n5zr2k84i057fmwa1ypfy";
};
}
{
goPackagePath = "github.com/hashicorp/golang-lru";
fetch = {
type = "git";
url = "https://github.com/hashicorp/golang-lru";
rev = "v0.5.0";
sha256 = "12k2cp2k615fjvfa5hyb9k2alian77wivds8s65diwshwv41939f";
};
}
{
goPackagePath = "github.com/hashicorp/hcl";
fetch = {
type = "git";
url = "https://github.com/hashicorp/hcl";
rev = "v1.0.0";
sha256 = "0q6ml0qqs0yil76mpn4mdx4lp94id8vbv575qm60jzl1ijcl5i66";
};
}
{
goPackagePath = "github.com/inconshreveable/mousetrap";
fetch = {
type = "git";
url = "https://github.com/inconshreveable/mousetrap";
rev = "v1.0.0";
sha256 = "1mn0kg48xkd74brf48qf5hzp0bc6g8cf5a77w895rl3qnlpfw152";
};
}
{
goPackagePath = "github.com/jdkato/prose";
fetch = {
type = "git";
url = "https://github.com/jdkato/prose";
rev = "v1.1.0";
sha256 = "1gjqgrpc7wbqvnhgwyfhxng24qvx37qjy0x2mbikiw1vaygxqsmy";
};
}
{
goPackagePath = "github.com/kr/pretty";
fetch = {
type = "git";
url = "https://github.com/kr/pretty";
rev = "v0.1.0";
sha256 = "18m4pwg2abd0j9cn5v3k2ksk9ig4vlwxmlw9rrglanziv9l967qp";
};
}
{
goPackagePath = "github.com/kr/pty";
fetch = {
type = "git";
url = "https://github.com/kr/pty";
rev = "v1.1.1";
sha256 = "0383f0mb9kqjvncqrfpidsf8y6ns5zlrc91c6a74xpyxjwvzl2y6";
};
}
{
goPackagePath = "github.com/kr/text";
fetch = {
type = "git";
url = "https://github.com/kr/text";
rev = "v0.1.0";
sha256 = "1gm5bsl01apvc84bw06hasawyqm4q84vx1pm32wr9jnd7a8vjgj1";
};
}
{
goPackagePath = "github.com/kyokomi/emoji";
fetch = {
type = "git";
url = "https://github.com/kyokomi/emoji";
rev = "v1.5.1";
sha256 = "005rxyxlqcd2sfjn686xb52l11wn2w0g5jv042ka6pnsx24r812a";
};
}
{
goPackagePath = "github.com/magefile/mage";
fetch = {
type = "git";
url = "https://github.com/magefile/mage";
rev = "v1.4.0";
sha256 = "177hzmmzhk7bcm3jj2cj6d5l9h5ql3cikvndhk4agkslrhwr3xka";
};
}
{
goPackagePath = "github.com/magiconair/properties";
fetch = {
type = "git";
url = "https://github.com/magiconair/properties";
rev = "v1.8.0";
sha256 = "1a10362wv8a8qwb818wygn2z48lgzch940hvpv81hv8gc747ajxn";
};
}
{
goPackagePath = "github.com/markbates/inflect";
fetch = {
type = "git";
url = "https://github.com/markbates/inflect";
rev = "v1.0.0";
sha256 = "072a73ij23mp8vabr8xwga2kj8dimya44ciiy9g4x4r9imm86psw";
};
}
{
goPackagePath = "github.com/matryer/try";
fetch = {
type = "git";
url = "https://github.com/matryer/try";
rev = "9ac251b645a2";
sha256 = "19fnqmpl3p54vmxgm1hmqvdc87brqx754wf3cdhq1bj04fcbb5h9";
};
}
{
goPackagePath = "github.com/mattn/go-colorable";
fetch = {
type = "git";
url = "https://github.com/mattn/go-colorable";
rev = "v0.0.9";
sha256 = "1nwjmsppsjicr7anq8na6md7b1z84l9ppnlr045hhxjvbkqwalvx";
};
}
{
goPackagePath = "github.com/mattn/go-isatty";
fetch = {
type = "git";
url = "https://github.com/mattn/go-isatty";
rev = "v0.0.4";
sha256 = "0zs92j2cqaw9j8qx1sdxpv3ap0rgbs0vrvi72m40mg8aa36gd39w";
};
}
{
goPackagePath = "github.com/mattn/go-runewidth";
fetch = {
type = "git";
url = "https://github.com/mattn/go-runewidth";
rev = "v0.0.3";
sha256 = "0lc39b6xrxv7h3v3y1kgz49cgi5qxwlygs715aam6ba35m48yi7g";
};
}
{
goPackagePath = "github.com/miekg/mmark";
fetch = {
type = "git";
url = "https://github.com/miekg/mmark";
rev = "v1.3.6";
sha256 = "0q2zrwa2vwk7a0zhmi000zpqrc01zssrj9c5n3573rg68fksg77m";
};
}
{
goPackagePath = "github.com/mitchellh/hashstructure";
fetch = {
type = "git";
url = "https://github.com/mitchellh/hashstructure";
rev = "v1.0.0";
sha256 = "0zgl5c03ip2yzkb9b7fq9ml08i7j8prgd46ha1fcg8c6r7k9xl3i";
};
}
{
goPackagePath = "github.com/mitchellh/mapstructure";
fetch = {
type = "git";
url = "https://github.com/mitchellh/mapstructure";
rev = "v1.1.2";
sha256 = "03bpv28jz9zhn4947saqwi328ydj7f6g6pf1m2d4m5zdh5jlfkrr";
};
}
{
goPackagePath = "github.com/muesli/smartcrop";
fetch = {
type = "git";
url = "https://github.com/muesli/smartcrop";
rev = "f6ebaa786a12";
sha256 = "0xbv5wbn0z36nkw9ay3ly6z23lpsrs0khryl1w54fz85lvwh66gp";
};
}
{
goPackagePath = "github.com/nfnt/resize";
fetch = {
type = "git";
url = "https://github.com/nfnt/resize";
rev = "83c6a9932646";
sha256 = "005cpiwq28krbjf0zjwpfh63rp4s4is58700idn24fs3g7wdbwya";
};
}
{
goPackagePath = "github.com/nicksnyder/go-i18n";
fetch = {
type = "git";
url = "https://github.com/nicksnyder/go-i18n";
rev = "v1.10.0";
sha256 = "1nlvq85c232z5yjs86pxpmkv7hk6gb5pa6j4hhzgdz85adk2ma04";
};
}
{
goPackagePath = "github.com/olekukonko/tablewriter";
fetch = {
type = "git";
url = "https://github.com/olekukonko/tablewriter";
rev = "d4647c9c7a84";
sha256 = "1274k5r9ardh1f6gsmadxmdds7zy8rkr55fb9swvnm0vazr3y01l";
};
}
{
goPackagePath = "github.com/pelletier/go-toml";
fetch = {
type = "git";
url = "https://github.com/pelletier/go-toml";
rev = "v1.2.0";
sha256 = "1fjzpcjng60mc3a4b2ql5a00d5gah84wj740dabv9kq67mpg8fxy";
};
}
{
goPackagePath = "github.com/pkg/errors";
fetch = {
type = "git";
url = "https://github.com/pkg/errors";
rev = "v0.8.0";
sha256 = "001i6n71ghp2l6kdl3qq1v2vmghcz3kicv9a5wgcihrzigm75pp5";
};
}
{
goPackagePath = "github.com/pmezard/go-difflib";
fetch = {
type = "git";
url = "https://github.com/pmezard/go-difflib";
rev = "v1.0.0";
sha256 = "0c1cn55m4rypmscgf0rrb88pn58j3ysvc2d0432dp3c6fqg6cnzw";
};
}
{
goPackagePath = "github.com/russross/blackfriday";
fetch = {
type = "git";
url = "https://github.com/russross/blackfriday";
rev = "46c73eb196ba";
sha256 = "01z1jsdkac09cw95lqq4pahkw9xnini2mb956lvb772bby2x3dmj";
};
}
{
goPackagePath = "github.com/sanity-io/litter";
fetch = {
type = "git";
url = "https://github.com/sanity-io/litter";
rev = "v1.1.0";
sha256 = "09nywwxxd6rmhxc7rsvs96ynjszmnvmhwr7dvh1n35hb6h9y7s2r";
};
}
{
goPackagePath = "github.com/sergi/go-diff";
fetch = {
type = "git";
url = "https://github.com/sergi/go-diff";
rev = "v1.0.0";
sha256 = "0swiazj8wphs2zmk1qgq75xza6m19snif94h2m6fi8dqkwqdl7c7";
};
}
{
goPackagePath = "github.com/shurcooL/sanitized_anchor_name";
fetch = {
type = "git";
url = "https://github.com/shurcooL/sanitized_anchor_name";
rev = "86672fcb3f95";
sha256 = "142m507s9971cl8qdmbcw7sqxnkgi3xqd8wzvfq15p0w7w8i4a3h";
};
}
{
goPackagePath = "github.com/spf13/afero";
fetch = {
type = "git";
url = "https://github.com/spf13/afero";
rev = "v1.2.1";
sha256 = "14qqj0cz6a595vn4dp747vddx05fd77jdsyl85qjmf9baymaxlam";
};
}
{
goPackagePath = "github.com/spf13/cast";
fetch = {
type = "git";
url = "https://github.com/spf13/cast";
rev = "v1.3.0";
sha256 = "0xq1ffqj8y8h7dcnm0m9lfrh0ga7pssnn2c1dnr09chqbpn4bdc5";
};
}
{
goPackagePath = "github.com/spf13/cobra";
fetch = {
type = "git";
url = "https://github.com/spf13/cobra";
rev = "v0.0.3";
sha256 = "1q1nsx05svyv9fv3fy6xv6gs9ffimkyzsfm49flvl3wnvf1ncrkd";
};
}
{
goPackagePath = "github.com/spf13/fsync";
fetch = {
type = "git";
url = "https://github.com/spf13/fsync";
rev = "12a01e648f05";
sha256 = "1vvbgxbbsc4mvi1axgqgn9pzjz1p495dsmwpc7mr8qxh8f6s0nhv";
};
}
{
goPackagePath = "github.com/spf13/jwalterweatherman";
fetch = {
type = "git";
url = "https://github.com/spf13/jwalterweatherman";
rev = "94f6ae3ed3bc";
sha256 = "1ywmkwci5zyd88ijym6f30fj5c0k2yayxarkmnazf5ybljv50q7b";
};
}
{
goPackagePath = "github.com/spf13/nitro";
fetch = {
type = "git";
url = "https://github.com/spf13/nitro";
rev = "24d7ef30a12d";
sha256 = "143sbpx0jdgf8f8ayv51x6l4jg6cnv6nps6n60qxhx4vd90s6mib";
};
}
{
goPackagePath = "github.com/spf13/pflag";
fetch = {
type = "git";
url = "https://github.com/spf13/pflag";
rev = "v1.0.3";
sha256 = "1cj3cjm7d3zk0mf1xdybh0jywkbbw7a6yr3y22x9sis31scprswd";
};
}
{
goPackagePath = "github.com/spf13/viper";
fetch = {
type = "git";
url = "https://github.com/spf13/viper";
rev = "v1.3.1";
sha256 = "1190mg04718r03qriav99sf4kx2n7wdgr8vdni15f74bpbzrdjrl";
};
}
{
goPackagePath = "github.com/stretchr/testify";
fetch = {
type = "git";
url = "https://github.com/stretchr/testify";
rev = "04af85275a5c";
sha256 = "1al7hgvg34xbajds99ss5wmlndxbzzmz5l0wrg6wchvvfaiwxlx0";
};
}
{
goPackagePath = "github.com/tdewolff/minify";
fetch = {
type = "git";
url = "https://github.com/tdewolff/minify";
rev = "v2.3.7";
sha256 = "1mj1lmd8s0mrg9cfj1ihvsqrbsbpzh3icm0pmayd2r6jp6rbffw6";
};
}
{
goPackagePath = "github.com/tdewolff/parse";
fetch = {
type = "git";
url = "https://github.com/tdewolff/parse";
rev = "v2.3.5";
sha256 = "05w859s31dx6525wrjryby601z9c0xpncilznk6shgqygpxda6cz";
};
}
{
goPackagePath = "github.com/tdewolff/test";
fetch = {
type = "git";
url = "https://github.com/tdewolff/test";
rev = "v1.0.0";
sha256 = "10vyp4bhanzg3yl9k8zqfdrxpsmx8yc53xv4lqxfymd7jjyqgssj";
};
}
{
goPackagePath = "github.com/ugorji/go";
fetch = {
type = "git";
url = "https://github.com/ugorji/go";
rev = "d75b2dcb6bc8";
sha256 = "0di1k35gpq9bp958ywranpbskx2vdwlb38s22vl9rybm3wa5g3ps";
};
}
{
goPackagePath = "github.com/wellington/go-libsass";
fetch = {
type = "git";
url = "https://github.com/wellington/go-libsass";
rev = "c63644206701";
sha256 = "1ml0fk4wldnjlkmliydnig9f3rpp3cdzwgz331mlqyadvma3c0lf";
};
}
{
goPackagePath = "github.com/xordataexchange/crypt";
fetch = {
type = "git";
url = "https://github.com/xordataexchange/crypt";
rev = "b2862e3d0a77";
sha256 = "04q3856anpzl4gdfgmg7pbp9cx231nkz3ymq2xp27rnmmwhfxr8y";
};
}
{
goPackagePath = "github.com/yosssi/ace";
fetch = {
type = "git";
url = "https://github.com/yosssi/ace";
rev = "v0.0.5";
sha256 = "1kbvbc56grrpnl65grygd23gyn3nkkhxdg8awhzkjmd0cvki8w1f";
};
}
{
goPackagePath = "golang.org/x/crypto";
fetch = {
type = "git";
url = "https://go.googlesource.com/crypto";
rev = "505ab145d0a9";
sha256 = "1vbsvcvmjz6c00p5vf8ls533p52fx2y3gy6v4k5qrdlzl4wf0i5s";
};
}
{
goPackagePath = "golang.org/x/image";
fetch = {
type = "git";
url = "https://go.googlesource.com/image";
rev = "c73c2afc3b81";
sha256 = "1kkafy29vz5xf6r29ghbvvbwrgjxwxvzk6dsa2qhyp1ddk6l2vkz";
};
}
{
goPackagePath = "golang.org/x/net";
fetch = {
type = "git";
url = "https://go.googlesource.com/net";
rev = "161cd47e91fd";
sha256 = "0254ld010iijygbzykib2vags1dc0wlmcmhgh4jl8iny159lhbcv";
};
}
{
goPackagePath = "golang.org/x/sync";
fetch = {
type = "git";
url = "https://go.googlesource.com/sync";
rev = "1d60e4601c6f";
sha256 = "046jlanz2lkxq1r57x9bl6s4cvfqaic6p2xybsj8mq1120jv4rs6";
};
}
{
goPackagePath = "golang.org/x/sys";
fetch = {
type = "git";
url = "https://go.googlesource.com/sys";
rev = "b4a75ba826a6";
sha256 = "0kzrd2wywkcq35iakbzplqyma4bvf2ng3mzi7917kxcbdq3fflrj";
};
}
{
goPackagePath = "golang.org/x/text";
fetch = {
type = "git";
url = "https://go.googlesource.com/text";
rev = "v0.3.0";
sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19";
};
}
{
goPackagePath = "gopkg.in/check.v1";
fetch = {
type = "git";
url = "https://gopkg.in/check.v1";
rev = "788fd7840127";
sha256 = "0v3bim0j375z81zrpr5qv42knqs0y2qv2vkjiqi5axvb78slki1a";
};
}
{
goPackagePath = "gopkg.in/yaml.v2";
fetch = {
type = "git";
url = "https://gopkg.in/yaml.v2";
rev = "v2.2.2";
sha256 = "01wj12jzsdqlnidpyjssmj0r4yavlqy7dwrg7adqd8dicjc4ncsa";
};
}
]

View File

@ -1,22 +1,23 @@
{ stdenv, buildGoPackage, fetchFromGitHub }:
{ stdenv, buildGoModule, fetchFromGitHub }:
buildGoPackage rec {
name = "terminal-parrot-1.1.0";
version = "1.1.0";
goPackagePath = "github.com/jmhobbs/terminal-parrot";
buildGoModule rec {
name = "terminal-parrot-${version}";
version = "1.1.1";
src = fetchFromGitHub {
owner = "jmhobbs";
repo = "terminal-parrot";
rev = "22c9bde916c12d8b13cf80ab252995dbf47837d1";
sha256 = "1mrxmifsmndf6hdq1956p1gyrrp3abh3rmwjcmxar8x2wqbv748y";
};
src = fetchFromGitHub {
owner = "jmhobbs";
repo = "terminal-parrot";
rev = "${version}";
sha256 = "1b4vr4s1zpkpf5kc1r2kdlp3hf88qp1f7h05g8kd62zf4sfbj722";
};
meta = with stdenv.lib; {
description = "Shows colorful, animated party parrot in your terminial";
homepage = https://github.com/jmhobbs/terminal-parrot;
license = licenses.mit;
platforms = platforms.all;
maintainers = [ maintainers.heel ];
};
modSha256 = "0ymqhrkgk94z4f2p3c6v75g2h8qlqzdi7byivqzxzmdczmq9zq2s";
meta = with stdenv.lib; {
description = "Shows colorful, animated party parrot in your terminial";
homepage = https://github.com/jmhobbs/terminal-parrot;
license = licenses.mit;
platforms = platforms.all;
maintainers = [ maintainers.heel ];
};
}

View File

@ -1,11 +1,9 @@
{ lib, buildGoPackage, fetchFromGitHub }:
{ lib, buildGoModule, fetchFromGitHub }:
buildGoPackage rec {
buildGoModule rec {
name = "todoist-${version}";
version = "0.13.1";
goPackagePath = "github.com/sachaos/todoist";
src = fetchFromGitHub {
owner = "sachaos";
repo = "todoist";
@ -13,7 +11,7 @@ buildGoPackage rec {
sha256 = "1kwvlsjr2a7wdhlwpxxpdh87wz8k9yjwl59vl2g7ya6m0rvhd3mc";
};
goDeps = ./deps.nix;
modSha256 = "0ng1paw2mizhs4g28ypxz0ryh43l90qw8qsq46sshsiiswvrpl0k";
meta = {
homepage = https://github.com/sachaos/todoist;

View File

@ -1,237 +0,0 @@
# file generated from go.mod using vgo2nix (https://github.com/adisbladis/vgo2nix)
[
{
goPackagePath = "github.com/BurntSushi/toml";
fetch = {
type = "git";
url = "https://github.com/BurntSushi/toml";
rev = "v0.3.1";
sha256 = "1fjdwwfzyzllgiwydknf1pwjvy49qxfsczqx5gz3y0izs7as99j6";
};
}
{
goPackagePath = "github.com/davecgh/go-spew";
fetch = {
type = "git";
url = "https://github.com/davecgh/go-spew";
rev = "v1.1.1";
sha256 = "0hka6hmyvp701adzag2g26cxdj47g21x6jz4sc6jjz1mn59d474y";
};
}
{
goPackagePath = "github.com/fatih/color";
fetch = {
type = "git";
url = "https://github.com/fatih/color";
rev = "v1.7.0";
sha256 = "0v8msvg38r8d1iiq2i5r4xyfx0invhc941kjrsg5gzwvagv55inv";
};
}
{
goPackagePath = "github.com/fsnotify/fsnotify";
fetch = {
type = "git";
url = "https://github.com/fsnotify/fsnotify";
rev = "v1.4.7";
sha256 = "07va9crci0ijlivbb7q57d2rz9h27zgn2fsm60spjsqpdbvyrx4g";
};
}
{
goPackagePath = "github.com/gofrs/uuid";
fetch = {
type = "git";
url = "https://github.com/gofrs/uuid";
rev = "v3.2.0";
sha256 = "1q63mp7bznhfgyw133c0wc0hpcj1cq9bcf7w1f8r6inkcrils1fz";
};
}
{
goPackagePath = "github.com/hashicorp/hcl";
fetch = {
type = "git";
url = "https://github.com/hashicorp/hcl";
rev = "v1.0.0";
sha256 = "0q6ml0qqs0yil76mpn4mdx4lp94id8vbv575qm60jzl1ijcl5i66";
};
}
{
goPackagePath = "github.com/magiconair/properties";
fetch = {
type = "git";
url = "https://github.com/magiconair/properties";
rev = "v1.8.0";
sha256 = "1a10362wv8a8qwb818wygn2z48lgzch940hvpv81hv8gc747ajxn";
};
}
{
goPackagePath = "github.com/mattn/go-colorable";
fetch = {
type = "git";
url = "https://github.com/mattn/go-colorable";
rev = "v0.0.9";
sha256 = "1nwjmsppsjicr7anq8na6md7b1z84l9ppnlr045hhxjvbkqwalvx";
};
}
{
goPackagePath = "github.com/mattn/go-isatty";
fetch = {
type = "git";
url = "https://github.com/mattn/go-isatty";
rev = "v0.0.4";
sha256 = "0zs92j2cqaw9j8qx1sdxpv3ap0rgbs0vrvi72m40mg8aa36gd39w";
};
}
{
goPackagePath = "github.com/mitchellh/go-homedir";
fetch = {
type = "git";
url = "https://github.com/mitchellh/go-homedir";
rev = "v1.0.0";
sha256 = "0f0z0aa4wivk4z1y503dmnw0k0g0g403dly8i4q263gfshs82sbq";
};
}
{
goPackagePath = "github.com/mitchellh/mapstructure";
fetch = {
type = "git";
url = "https://github.com/mitchellh/mapstructure";
rev = "v1.0.0";
sha256 = "0f06q4fpzg0c370cvmpsl0iq2apl5nkbz5cd3nba5x5ysmshv1lm";
};
}
{
goPackagePath = "github.com/pelletier/go-toml";
fetch = {
type = "git";
url = "https://github.com/pelletier/go-toml";
rev = "v1.2.0";
sha256 = "1fjzpcjng60mc3a4b2ql5a00d5gah84wj740dabv9kq67mpg8fxy";
};
}
{
goPackagePath = "github.com/pkg/browser";
fetch = {
type = "git";
url = "https://github.com/pkg/browser";
rev = "0a3d74bf9ce4";
sha256 = "0lv6kwvm31n79mh14a63zslaf4l9bspi2q0i8i9im4njfl42iv1c";
};
}
{
goPackagePath = "github.com/pmezard/go-difflib";
fetch = {
type = "git";
url = "https://github.com/pmezard/go-difflib";
rev = "v1.0.0";
sha256 = "0c1cn55m4rypmscgf0rrb88pn58j3ysvc2d0432dp3c6fqg6cnzw";
};
}
{
goPackagePath = "github.com/spf13/afero";
fetch = {
type = "git";
url = "https://github.com/spf13/afero";
rev = "v1.1.2";
sha256 = "0miv4faf5ihjfifb1zv6aia6f6ik7h1s4954kcb8n6ixzhx9ck6k";
};
}
{
goPackagePath = "github.com/spf13/cast";
fetch = {
type = "git";
url = "https://github.com/spf13/cast";
rev = "v1.2.0";
sha256 = "177bk7lq40jbgv9p9r80aydpaccfk8ja3a7jjhfwiwk9r1pa4rr2";
};
}
{
goPackagePath = "github.com/spf13/jwalterweatherman";
fetch = {
type = "git";
url = "https://github.com/spf13/jwalterweatherman";
rev = "v1.0.0";
sha256 = "093fmmvavv84pv4q84hav7ph3fmrq87bvspjj899q0qsx37yvdr8";
};
}
{
goPackagePath = "github.com/spf13/pflag";
fetch = {
type = "git";
url = "https://github.com/spf13/pflag";
rev = "v1.0.2";
sha256 = "005598piihl3l83a71ahj10cpq9pbhjck4xishx1b4dzc02r9xr2";
};
}
{
goPackagePath = "github.com/spf13/viper";
fetch = {
type = "git";
url = "https://github.com/spf13/viper";
rev = "v1.2.1";
sha256 = "0y7czxki8zhjhanh5ydnx4sf2darw70z2i5dskgarbk4gjmagx6k";
};
}
{
goPackagePath = "github.com/stretchr/testify";
fetch = {
type = "git";
url = "https://github.com/stretchr/testify";
rev = "v1.2.2";
sha256 = "0dlszlshlxbmmfxj5hlwgv3r22x0y1af45gn1vd198nvvs3pnvfs";
};
}
{
goPackagePath = "github.com/urfave/cli";
fetch = {
type = "git";
url = "https://github.com/urfave/cli";
rev = "v1.20.0";
sha256 = "0y6f4sbzkiiwrxbl15biivj8c7qwxnvm3zl2dd3mw4wzg4x10ygj";
};
}
{
goPackagePath = "golang.org/x/sys";
fetch = {
type = "git";
url = "https://go.googlesource.com/sys";
rev = "8cf3aee42992";
sha256 = "1l2hyd5z91jzml5isn1i0g882pxbxk0x6ry5vdwghrprcx06syag";
};
}
{
goPackagePath = "golang.org/x/text";
fetch = {
type = "git";
url = "https://go.googlesource.com/text";
rev = "v0.3.0";
sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19";
};
}
{
goPackagePath = "golang.org/x/tools";
fetch = {
type = "git";
url = "https://go.googlesource.com/tools";
rev = "77439c55185e";
sha256 = "15f7yghpw9yn00s1k8czld8cm3kvjx5rzda2gfm8pq5542i8w9rs";
};
}
{
goPackagePath = "gopkg.in/check.v1";
fetch = {
type = "git";
url = "https://gopkg.in/check.v1";
rev = "20d25e280405";
sha256 = "0k1m83ji9l1a7ng8a7v40psbymxasmssbrrhpdv2wl4rhs0nc3np";
};
}
{
goPackagePath = "gopkg.in/yaml.v2";
fetch = {
type = "git";
url = "https://gopkg.in/yaml.v2";
rev = "v2.2.1";
sha256 = "0dwjrs2lp2gdlscs7bsrmyc5yf6mm4fvgw71bzr9mv2qrd2q73s1";
};
}
]

View File

@ -1,19 +1,22 @@
{ lib, buildGoPackage, fetchFromGitHub, ... }:
{ lib, buildGoModule, fetchFromGitHub }:
buildGoPackage rec {
pname = "hetzner-kube";
version = "0.3.2-rc1";
buildGoModule rec {
name = "hetzner-kube-${version}";
version = "0.4.1";
src = fetchFromGitHub {
owner = "xetys";
repo = "hetzner-kube";
rev = version;
sha256 = "16pzcpcr98rcrv5k57fa7h9a82wiv4p2ckhkmisynkr7f1xk60mw";
rev = "${version}";
sha256 = "11202i3340vaz8xh59gwj5x0djcgbzq9jfy2214lcpml71qc85f0";
};
goPackagePath = "github.com/xetys/hetzner-kube";
subPackages = ["."];
goDeps = ./deps.nix;
modSha256 = "1mx74nci7j7h44pw1qf5fxkvfnhppj46898f8895ay8hhxd28lbm";
buildFlagsArray = ''
-ldflags=
-X github.com/xetys/hetzner-kube/cmd.version=${version}
'';
meta = {
description = "A CLI tool for provisioning Kubernetes clusters on Hetzner Cloud";

View File

@ -1,255 +0,0 @@
# file generated from Gopkg.lock using dep2nix (https://github.com/nixcloud/dep2nix)
[
{
goPackagePath = "github.com/Pallinder/go-randomdata";
fetch = {
type = "git";
url = "https://github.com/Pallinder/go-randomdata";
rev = "15df0648130a623e418886f81b2aaecd0a00547b";
sha256 = "1kdrchnhp71spz6amcbxr5m0pdksbqx8jjydvxb82pw43rrbx6s7";
};
}
{
goPackagePath = "github.com/andreyvit/diff";
fetch = {
type = "git";
url = "https://github.com/andreyvit/diff";
rev = "c7f18ee00883bfd3b00e0a2bf7607827e0148ad4";
sha256 = "1s4qjkxig5yqahpzfl4xqh4kzi9mymdpkzq6kj3f4dr5dl3hlynr";
};
}
{
goPackagePath = "github.com/fsnotify/fsnotify";
fetch = {
type = "git";
url = "https://github.com/fsnotify/fsnotify";
rev = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9";
sha256 = "07va9crci0ijlivbb7q57d2rz9h27zgn2fsm60spjsqpdbvyrx4g";
};
}
{
goPackagePath = "github.com/go-kit/kit";
fetch = {
type = "git";
url = "https://github.com/go-kit/kit";
rev = "ca4112baa34cb55091301bdc13b1420a122b1b9e";
sha256 = "0vsqmjnd3zj3qxg455kz27fjd9zh2vx5x17hfgzjv2pqsg3jas13";
};
}
{
goPackagePath = "github.com/go-logfmt/logfmt";
fetch = {
type = "git";
url = "https://github.com/go-logfmt/logfmt";
rev = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5";
sha256 = "1gkgh3k5w1xwb2qbjq52p6azq3h1c1rr6pfwjlwj1zrijpzn2xb9";
};
}
{
goPackagePath = "github.com/go-stack/stack";
fetch = {
type = "git";
url = "https://github.com/go-stack/stack";
rev = "259ab82a6cad3992b4e21ff5cac294ccb06474bc";
sha256 = "0irkqifyj84cbnq4n66ax2r591id2285diw5hzcz2k3bga8d8lqr";
};
}
{
goPackagePath = "github.com/gosuri/uilive";
fetch = {
type = "git";
url = "https://github.com/gosuri/uilive";
rev = "ac356e6e42cd31fcef8e6aec13ae9ed6fe87713e";
sha256 = "1k28zbc14p1yqzhamp9rcagjdw6wsdb55m08nx758jwlr31az6jy";
};
}
{
goPackagePath = "github.com/gosuri/uiprogress";
fetch = {
type = "git";
url = "https://github.com/gosuri/uiprogress";
rev = "d0567a9d84a1c40dd7568115ea66f4887bf57b33";
sha256 = "1m7rxf71mn8w2yysc8wmf2703avhci6f4nkiijjl1f2cx4kzykck";
};
}
{
goPackagePath = "github.com/hashicorp/hcl";
fetch = {
type = "git";
url = "https://github.com/hashicorp/hcl";
rev = "ef8a98b0bbce4a65b5aa4c368430a80ddc533168";
sha256 = "1qalfsc31fra7hcw2lc3s20aj7al62fq3j5fn5kga3mg99b82nyr";
};
}
{
goPackagePath = "github.com/hetznercloud/hcloud-go";
fetch = {
type = "git";
url = "https://github.com/hetznercloud/hcloud-go";
rev = "400c6f026bf3c8d5fead3df7806e6981a16bb6b8";
sha256 = "0y6y7glnzbrzmly2j139vj8279w3c8bm1zc2mzljwyjpa6pvp7di";
};
}
{
goPackagePath = "github.com/inconshreveable/mousetrap";
fetch = {
type = "git";
url = "https://github.com/inconshreveable/mousetrap";
rev = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75";
sha256 = "1mn0kg48xkd74brf48qf5hzp0bc6g8cf5a77w895rl3qnlpfw152";
};
}
{
goPackagePath = "github.com/kr/logfmt";
fetch = {
type = "git";
url = "https://github.com/kr/logfmt";
rev = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0";
sha256 = "02ldzxgznrfdzvghfraslhgp19la1fczcbzh7wm2zdc6lmpd1qq9";
};
}
{
goPackagePath = "github.com/magiconair/properties";
fetch = {
type = "git";
url = "https://github.com/magiconair/properties";
rev = "c2353362d570a7bfa228149c62842019201cfb71";
sha256 = "1a10362wv8a8qwb818wygn2z48lgzch940hvpv81hv8gc747ajxn";
};
}
{
goPackagePath = "github.com/mattn/go-isatty";
fetch = {
type = "git";
url = "https://github.com/mattn/go-isatty";
rev = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39";
sha256 = "06w45aqz2a6yrk25axbly2k5wmsccv8cspb94bfmz4izvw8h927n";
};
}
{
goPackagePath = "github.com/mitchellh/go-homedir";
fetch = {
type = "git";
url = "https://github.com/mitchellh/go-homedir";
rev = "58046073cbffe2f25d425fe1331102f55cf719de";
sha256 = "0kwflrwsjdsy8vbhyzicc4c2vdi7lhdvn4rarfr18x1qsrb7n1bx";
};
}
{
goPackagePath = "github.com/mitchellh/mapstructure";
fetch = {
type = "git";
url = "https://github.com/mitchellh/mapstructure";
rev = "f15292f7a699fcc1a38a80977f80a046874ba8ac";
sha256 = "0zm3nhdvmj3f8q0vg2sjfw1sm3pwsw0ggz501awz95w99664a8al";
};
}
{
goPackagePath = "github.com/pelletier/go-toml";
fetch = {
type = "git";
url = "https://github.com/pelletier/go-toml";
rev = "c01d1270ff3e442a8a57cddc1c92dc1138598194";
sha256 = "1fjzpcjng60mc3a4b2ql5a00d5gah84wj740dabv9kq67mpg8fxy";
};
}
{
goPackagePath = "github.com/sergi/go-diff";
fetch = {
type = "git";
url = "https://github.com/sergi/go-diff";
rev = "1744e2970ca51c86172c8190fadad617561ed6e7";
sha256 = "0swiazj8wphs2zmk1qgq75xza6m19snif94h2m6fi8dqkwqdl7c7";
};
}
{
goPackagePath = "github.com/spf13/afero";
fetch = {
type = "git";
url = "https://github.com/spf13/afero";
rev = "787d034dfe70e44075ccc060d346146ef53270ad";
sha256 = "0138rjiacl71h7kvhzinviwvy6qa2m6rflpv9lgqv15hnjvhwvg1";
};
}
{
goPackagePath = "github.com/spf13/cast";
fetch = {
type = "git";
url = "https://github.com/spf13/cast";
rev = "8965335b8c7107321228e3e3702cab9832751bac";
sha256 = "177bk7lq40jbgv9p9r80aydpaccfk8ja3a7jjhfwiwk9r1pa4rr2";
};
}
{
goPackagePath = "github.com/spf13/cobra";
fetch = {
type = "git";
url = "https://github.com/spf13/cobra";
rev = "ef82de70bb3f60c65fb8eebacbb2d122ef517385";
sha256 = "1q1nsx05svyv9fv3fy6xv6gs9ffimkyzsfm49flvl3wnvf1ncrkd";
};
}
{
goPackagePath = "github.com/spf13/jwalterweatherman";
fetch = {
type = "git";
url = "https://github.com/spf13/jwalterweatherman";
rev = "14d3d4c518341bea657dd8a226f5121c0ff8c9f2";
sha256 = "1f9154lijbz0kkgqwmbphykwl4adv4fvkx6n1p7fdq3x5j9g8i17";
};
}
{
goPackagePath = "github.com/spf13/pflag";
fetch = {
type = "git";
url = "https://github.com/spf13/pflag";
rev = "9a97c102cda95a86cec2345a6f09f55a939babf5";
sha256 = "005598piihl3l83a71ahj10cpq9pbhjck4xishx1b4dzc02r9xr2";
};
}
{
goPackagePath = "github.com/spf13/viper";
fetch = {
type = "git";
url = "https://github.com/spf13/viper";
rev = "907c19d40d9a6c9bb55f040ff4ae45271a4754b9";
sha256 = "177ziws6mwxdlvicmgpv7w7zy5ri2wgnw2f2v3789b5skv9d6a6b";
};
}
{
goPackagePath = "golang.org/x/crypto";
fetch = {
type = "git";
url = "https://go.googlesource.com/crypto";
rev = "de0752318171da717af4ce24d0a2e8626afaeb11";
sha256 = "1ps1dl2a5lwr3vbwcy8n4i1v73m567y024sk961fk281phrzp13i";
};
}
{
goPackagePath = "golang.org/x/sys";
fetch = {
type = "git";
url = "https://go.googlesource.com/sys";
rev = "1c9583448a9c3aa0f9a6a5241bf73c0bd8aafded";
sha256 = "0g0nc549pmdmvja4mdqh0kgvznnw6wliqmx5wrnj02l3a23vizmi";
};
}
{
goPackagePath = "golang.org/x/text";
fetch = {
type = "git";
url = "https://go.googlesource.com/text";
rev = "f21a4dfb5e38f5895301dc265a8def02365cc3d0";
sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19";
};
}
{
goPackagePath = "gopkg.in/yaml.v2";
fetch = {
type = "git";
url = "https://github.com/go-yaml/yaml";
rev = "5420a8b6744d3b0345ab293f6fcba19c978f1183";
sha256 = "0dwjrs2lp2gdlscs7bsrmyc5yf6mm4fvgw71bzr9mv2qrd2q73s1";
};
}
]

View File

@ -0,0 +1,36 @@
From 40b8eaacb3a24c466c17c8a65938330d5805b112 Mon Sep 17 00:00:00 2001
From: "Wael M. Nasreddine" <wael.nasreddine@gmail.com>
Date: Fri, 8 Mar 2019 14:10:11 -0800
Subject: [PATCH] chore: fix the location of thrift
Thrift is no longer available at the git.apache.org and it's now
distributed on GitHub at github.com/apache/thrift.
fixes #3320
---
go.mod | 2 ++
go.sum | 1 +
2 files changed, 3 insertions(+)
diff --git a/go.mod b/go.mod
index 04bcc84cc..e26c4cf1d 100644
--- a/go.mod
+++ b/go.mod
@@ -184,3 +184,5 @@ replace k8s.io/metrics => k8s.io/metrics v0.0.0-20181128195641-3954d62a524d
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190122181752-bebe27e40fb7
replace k8s.io/client-go => k8s.io/client-go v2.0.0-alpha.0.0.20190115164855-701b91367003+incompatible
+
+replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999
diff --git a/go.sum b/go.sum
index c9fdf8768..6ed69e69d 100644
--- a/go.sum
+++ b/go.sum
@@ -87,6 +87,7 @@ github.com/antham/chyle v1.4.0/go.mod h1:D94Z4aE/ECudyNoTHwkhqu77mjGPZtfPG8dNoeI
github.com/antham/envh v1.2.0/go.mod h1:ocIRPHuwwjyBVBtuUJOJc2TYzGg+d23xSAZexl4y9hQ=
github.com/antham/strumt v0.0.0-20171215230529-6776189777d3/go.mod h1:sE7EYIUE0nQzPiv5zQAmw2aVkei0j2xmb4gTIIqSFSI=
github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
+github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=

View File

@ -1,57 +1,39 @@
{ buildGoPackage, fetchFromGitHub, lib }:
{ buildGoModule, fetchFromGitHub, lib }:
let
removeVendoredPackages = goDeps:
''
echo "Removing any vendored duplicate of direct dependency... "
for dir in $(find $NIX_BUILD_TOP/go/src -type d -name vendor); do
${builtins.concatStringsSep "\n" (map (goDep: ''
if test -d $dir/${goDep.goPackagePath}; then
echo "Removing duplicate directory at $dir/${goDep.goPackagePath}"
rm -rf $dir/${goDep.goPackagePath}
fi
'') goDeps)}
done
echo "Done"
'';
in
buildGoPackage rec {
buildGoModule rec {
name = "jx";
version = "1.3.955";
goPackagePath = "github.com/jenkins-x/jx";
subPackages = [ "cmd/jx" ];
version = "1.3.967";
src = fetchFromGitHub {
owner = "jenkins-x";
repo = "jx";
rev = "v${version}";
sha256 = "0h4ck1a8rlyg10gaxbnwvlabwjlhdrigrina84x4m2gsqr3lnp9a";
sha256 = "0a25m7sz134kch21bg6l86kvwl4cg6babqf57kqidq6kid1zgdaq";
};
# Some of the dependencies have their own checked in vendor directory that
# vendor their dependencies. However, some of those dependencies are also
# directly pulled down through the vgo modules. Removing these dependencies
# as they confuse the go compiler and causes the build to fail.
# Removing all the vendor directories also breaks the build.
preBuild = removeVendoredPackages (import goDeps);
patches = [
# https://github.com/jenkins-x/jx/pull/3321
./3321-fix-location-of-thrift.patch
];
modSha256 = "0l6ccxzfxl918hzbky5ivlw413hiwagwc2cbp3f05i21qdi5mw5p";
subPackages = [ "cmd/jx" ];
buildFlagsArray = ''
-ldflags=
-X ${goPackagePath}/pkg/version.Version=${version}
-X ${goPackagePath}/pkg/version.Revision=${version}
-X github.com/jenkins-x/jx/pkg/version.Version=${version}
-X github.com/jenkins-x/jx/pkg/version.Revision=${version}
'';
goDeps = ./deps.nix;
meta = with lib; {
description = "JX is a command line tool for installing and using Jenkins X.";
homepage = https://jenkins-x.io;
longDescription = ''
Jenkins X provides automated CI+CD for Kubernetes with Preview
Environments on Pull Requests using Jenkins, Knative Build, Prow,
Skaffold and Helm.
'';
homepage = https://github.com/jenkins-x/jx;
license = licenses.asl20 ;
maintainers = with maintainers; [ kalbasit ];
platforms = platforms.linux ++ platforms.darwin;

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,14 @@
{ go, govers, lib, fetchgit, fetchhg, fetchbzr, rsync
, removeReferencesTo, fetchFromGitHub, stdenv }:
{ go, cacert, git, lib, removeReferencesTo, stdenv }:
{ buildInputs ? []
{ name
, src
, buildInputs ? []
, nativeBuildInputs ? []
, passthru ? {}
, preFixup ? ""
, shellHook ? ""
, patches ? []
# modSha256 is the sha256 of the vendored dependencies
, modSha256
# We want parallel builds by default
, enableParallelBuilding ? true
@ -13,121 +16,106 @@
# Disabled flag
, disabled ? false
# Go import path of the package
, goPackagePath
# Go package aliases
, goPackageAliases ? [ ]
# Extra sources to include in the gopath
, extraSrcs ? [ ]
# Extra gopaths containing src subfolder
# with sources to include in the gopath
, extraSrcPaths ? [ ]
# go2nix dependency file
, goDeps ? null
, dontRenameImports ? false
# Do not enable this without good reason
# IE: programs coupled with the compiler
, allowGoReference ? false
, meta ? {}, ... } @ args':
, meta ? {}
, ... }@args':
with builtins;
let
args = lib.filterAttrs (name: _: name != "extraSrcs") args';
args = removeAttrs args' [ "modSha256" "disabled" ];
removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
dep2src = goDep:
{
inherit (goDep) goPackagePath;
src = if goDep.fetch.type == "git" then
fetchgit {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "hg" then
fetchhg {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "bzr" then
fetchbzr {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "FromGitHub" then
fetchFromGitHub {
inherit (goDep.fetch) owner repo rev sha256;
}
else abort "Unrecognized package fetch type: ${goDep.fetch.type}";
};
go-modules = go.stdenv.mkDerivation {
name = "${name}-go-modules";
importGodeps = { depsFile }:
map dep2src (import depsFile);
goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs
else extraSrcs;
package = go.stdenv.mkDerivation (
(builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
nativeBuildInputs = [ removeReferencesTo go ]
++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;
buildInputs = buildInputs;
nativeBuildInputs = [ go git ];
inherit (args) src;
inherit (go) GOOS GOARCH;
configurePhase = args.configurePhase or ''
patches = args.patches or [];
GO111MODULE = "on";
# XXX: Add support for other fetchers, such as hg, bzr and alike.
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# Instruct Go where to find the cacert.
# SSL_CERT_FILE is used by Linux machines.
# NIX_SSL_CERT_FILE is used by Darwin machines based on
# pkgs/development/compilers/go/ssl-cert-file-1.9.patch.
NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND" "SOCKS_SERVER"
];
configurePhase = args.modConfigurePhase or ''
runHook preConfigure
# Extract the source
cd "$NIX_BUILD_TOP"
mkdir -p "go/src/$(dirname "$goPackagePath")"
mv "$sourceRoot" "go/src/$goPackagePath"
'' + lib.flip lib.concatMapStrings goPath ({ src, goPackagePath }: ''
mkdir goPath
(cd goPath; unpackFile "${src}")
mkdir -p "go/src/$(dirname "${goPackagePath}")"
chmod -R u+w goPath/*
mv goPath/* "go/src/${goPackagePath}"
rmdir goPath
'') + (lib.optionalString (extraSrcPaths != []) ''
${rsync}/bin/rsync -a ${lib.concatMapStringsSep " " (p: "${p}/src") extraSrcPaths} go
'') + ''
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
runHook postConfigure
'';
renameImports = args.renameImports or (
let
inputsWithAliases = lib.filter (x: x ? goPackageAliases)
(buildInputs ++ (args.propagatedBuildInputs or [ ]));
rename = to: from: "echo Renaming '${from}' to '${to}'; govers -d -m ${from} ${to}";
renames = p: lib.concatMapStringsSep "\n" (rename p.goPackagePath) p.goPackageAliases;
in lib.concatMapStringsSep "\n" renames inputsWithAliases);
buildPhase = args.modBuildPhase or ''
runHook preBuild
go mod download
runHook postBuild
'';
installPhase = args.modInstallPhase or ''
runHook preInstall
cp -r "''${GOPATH}/pkg/mod/cache/download" $out
runHook postInstall
'';
dontFixup = true;
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = modSha256;
};
package = go.stdenv.mkDerivation (args // {
nativeBuildInputs = [ removeReferencesTo go ] ++ nativeBuildInputs;
inherit (go) GOOS GOARCH;
GO111MODULE = "on";
configurePhase = args.configurePhase or ''
runHook preConfigure
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
export GOPROXY=file://${go-modules}
runHook postConfigure
'';
buildPhase = args.buildPhase or ''
runHook preBuild
runHook renameImports
buildGoDir() {
local d; local cmd;
cmd="$1"
d="$2"
. $TMPDIR/buildFlagsArray
echo "$d" | grep -q "\(/_\|examples\|Godeps\)" && return 0
echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0
[ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
local OUT
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then
@ -146,11 +134,9 @@ let
local type;
type="$1"
if [ -n "$subPackages" ]; then
echo "$subPackages" | sed "s,\(^\| \),\1$goPackagePath/,g"
echo "./$subPackages"
else
pushd "$NIX_BUILD_TOP/go/src" >/dev/null
find "$goPackagePath" -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort | uniq
popd >/dev/null
find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort --unique
fi
}
@ -172,7 +158,7 @@ let
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
# normalize cross-compiled builds w.r.t. native builds
(
dir=$NIX_BUILD_TOP/go/bin/${go.GOOS}_${go.GOARCH}
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
mv $dir/* $dir/..
fi
@ -198,47 +184,28 @@ let
installPhase = args.installPhase or ''
runHook preInstall
mkdir -p $bin
dir="$NIX_BUILD_TOP/go/bin"
[ -e "$dir" ] && cp -r $dir $bin
mkdir -p $out
dir="$GOPATH/bin"
[ -e "$dir" ] && cp -r $dir $out
runHook postInstall
'';
preFixup = preFixup + ''
find $bin/bin -type f -exec ${removeExpr removeReferences} '{}' + || true
preFixup = (args.preFixup or "") + ''
find $out/bin -type f -exec ${removeExpr removeReferences} '{}' + || true
'';
shellHook = ''
d=$(mktemp -d "--suffix=-$name")
'' + toString (map (dep: ''
mkdir -p "$d/src/$(dirname "${dep.goPackagePath}")"
ln -s "${dep.src}" "$d/src/${dep.goPackagePath}"
''
) goPath) + ''
export GOPATH=${lib.concatStringsSep ":" ( ["$d"] ++ ["$GOPATH"] ++ ["$PWD"] ++ extraSrcPaths)}
'' + shellHook;
disallowedReferences = lib.optional (!allowGoReference) go;
disallowedReferences = lib.optional (!allowGoReference) go
++ lib.optional (!dontRenameImports) govers;
passthru = passthru //
{ inherit go; } //
lib.optionalAttrs (goPackageAliases != []) { inherit goPackageAliases; };
enableParallelBuilding = enableParallelBuilding;
# I prefer to call this dev but propagatedBuildInputs expects $out to exist
outputs = args.outputs or [ "bin" "out" ];
passthru = passthru // { inherit go go-modules; };
meta = {
# Add default meta information
homepage = "https://${goPackagePath}";
platforms = go.meta.platforms or lib.platforms.all;
} // meta // {
# add an extra maintainer to every package
maintainers = (meta.maintainers or []) ++
[ lib.maintainers.ehmry lib.maintainers.lethalman ];
[ lib.maintainers.kalbasit ];
};
});
in if disabled then

View File

@ -0,0 +1,247 @@
{ go, govers, lib, fetchgit, fetchhg, fetchbzr, rsync
, removeReferencesTo, fetchFromGitHub, stdenv }:
{ buildInputs ? []
, nativeBuildInputs ? []
, passthru ? {}
, preFixup ? ""
, shellHook ? ""
# We want parallel builds by default
, enableParallelBuilding ? true
# Disabled flag
, disabled ? false
# Go import path of the package
, goPackagePath
# Go package aliases
, goPackageAliases ? [ ]
# Extra sources to include in the gopath
, extraSrcs ? [ ]
# Extra gopaths containing src subfolder
# with sources to include in the gopath
, extraSrcPaths ? [ ]
# go2nix dependency file
, goDeps ? null
, dontRenameImports ? false
# Do not enable this without good reason
# IE: programs coupled with the compiler
, allowGoReference ? false
, meta ? {}, ... } @ args':
with builtins;
let
args = lib.filterAttrs (name: _: name != "extraSrcs") args';
removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
dep2src = goDep:
{
inherit (goDep) goPackagePath;
src = if goDep.fetch.type == "git" then
fetchgit {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "hg" then
fetchhg {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "bzr" then
fetchbzr {
inherit (goDep.fetch) url rev sha256;
}
else if goDep.fetch.type == "FromGitHub" then
fetchFromGitHub {
inherit (goDep.fetch) owner repo rev sha256;
}
else abort "Unrecognized package fetch type: ${goDep.fetch.type}";
};
importGodeps = { depsFile }:
map dep2src (import depsFile);
goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs
else extraSrcs;
package = go.stdenv.mkDerivation (
(builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
nativeBuildInputs = [ removeReferencesTo go ]
++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;
buildInputs = buildInputs;
inherit (go) GOOS GOARCH;
configurePhase = args.configurePhase or ''
runHook preConfigure
# Extract the source
cd "$NIX_BUILD_TOP"
mkdir -p "go/src/$(dirname "$goPackagePath")"
mv "$sourceRoot" "go/src/$goPackagePath"
'' + lib.flip lib.concatMapStrings goPath ({ src, goPackagePath }: ''
mkdir goPath
(cd goPath; unpackFile "${src}")
mkdir -p "go/src/$(dirname "${goPackagePath}")"
chmod -R u+w goPath/*
mv goPath/* "go/src/${goPackagePath}"
rmdir goPath
'') + (lib.optionalString (extraSrcPaths != []) ''
${rsync}/bin/rsync -a ${lib.concatMapStringsSep " " (p: "${p}/src") extraSrcPaths} go
'') + ''
export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
export GOCACHE=$TMPDIR/go-cache
runHook postConfigure
'';
renameImports = args.renameImports or (
let
inputsWithAliases = lib.filter (x: x ? goPackageAliases)
(buildInputs ++ (args.propagatedBuildInputs or [ ]));
rename = to: from: "echo Renaming '${from}' to '${to}'; govers -d -m ${from} ${to}";
renames = p: lib.concatMapStringsSep "\n" (rename p.goPackagePath) p.goPackageAliases;
in lib.concatMapStringsSep "\n" renames inputsWithAliases);
buildPhase = args.buildPhase or ''
runHook preBuild
runHook renameImports
buildGoDir() {
local d; local cmd;
cmd="$1"
d="$2"
. $TMPDIR/buildFlagsArray
echo "$d" | grep -q "\(/_\|examples\|Godeps\)" && return 0
[ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
local OUT
if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" -v -p $NIX_BUILD_CORES $d 2>&1)"; then
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
echo "$OUT" >&2
return 1
fi
fi
if [ -n "$OUT" ]; then
echo "$OUT" >&2
fi
return 0
}
getGoDirs() {
local type;
type="$1"
if [ -n "$subPackages" ]; then
echo "$subPackages" | sed "s,\(^\| \),\1$goPackagePath/,g"
else
pushd "$NIX_BUILD_TOP/go/src" >/dev/null
find "$goPackagePath" -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort | uniq
popd >/dev/null
fi
}
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
buildFlagsArray+=(-x)
fi
if [ ''${#buildFlagsArray[@]} -ne 0 ]; then
declare -p buildFlagsArray > $TMPDIR/buildFlagsArray
else
touch $TMPDIR/buildFlagsArray
fi
if [ -z "$enableParallelBuilding" ]; then
export NIX_BUILD_CORES=1
fi
for pkg in $(getGoDirs ""); do
buildGoDir install "$pkg"
done
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
# normalize cross-compiled builds w.r.t. native builds
(
dir=$NIX_BUILD_TOP/go/bin/${go.GOOS}_${go.GOARCH}
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
mv $dir/* $dir/..
fi
if [[ -d $dir ]]; then
rmdir $dir
fi
)
'' + ''
runHook postBuild
'';
doCheck = args.doCheck or false;
checkPhase = args.checkPhase or ''
runHook preCheck
for pkg in $(getGoDirs test); do
buildGoDir test "$pkg"
done
runHook postCheck
'';
installPhase = args.installPhase or ''
runHook preInstall
mkdir -p $bin
dir="$NIX_BUILD_TOP/go/bin"
[ -e "$dir" ] && cp -r $dir $bin
runHook postInstall
'';
preFixup = preFixup + ''
find $bin/bin -type f -exec ${removeExpr removeReferences} '{}' + || true
'';
shellHook = ''
d=$(mktemp -d "--suffix=-$name")
'' + toString (map (dep: ''
mkdir -p "$d/src/$(dirname "${dep.goPackagePath}")"
ln -s "${dep.src}" "$d/src/${dep.goPackagePath}"
''
) goPath) + ''
export GOPATH=${lib.concatStringsSep ":" ( ["$d"] ++ ["$GOPATH"] ++ ["$PWD"] ++ extraSrcPaths)}
'' + shellHook;
disallowedReferences = lib.optional (!allowGoReference) go
++ lib.optional (!dontRenameImports) govers;
passthru = passthru //
{ inherit go; } //
lib.optionalAttrs (goPackageAliases != []) { inherit goPackageAliases; };
enableParallelBuilding = enableParallelBuilding;
# I prefer to call this dev but propagatedBuildInputs expects $out to exist
outputs = args.outputs or [ "bin" "out" ];
meta = {
# Add default meta information
homepage = "https://${goPackagePath}";
platforms = go.meta.platforms or lib.platforms.all;
} // meta // {
# add an extra maintainer to every package
maintainers = (meta.maintainers or []) ++
[ lib.maintainers.ehmry lib.maintainers.lethalman ];
};
});
in if disabled then
throw "${package.name} not supported for go ${go.meta.branch}"
else
package

View File

@ -0,0 +1 @@
export GOTOOLDIR=@bin@/bin

View File

@ -1,44 +1,41 @@
{ stdenv, go, buildGoPackage, fetchgit }:
{ stdenv, go, buildGoModule, fetchgit }:
buildGoPackage rec {
buildGoModule rec {
name = "gotools-unstable-${version}";
version = "2019-02-11";
rev = "44bee7e801e4a70b5fc9a91ff23830ab4df55d5e";
goPackagePath = "golang.org/x/tools";
goPackageAliases = [ "code.google.com/p/go.tools" ];
version = "2019-03-05";
rev = "00c44ba9c14f88ffdd4fb5bfae57fe8dd6d6afb1";
src = fetchgit {
inherit rev;
url = "https://go.googlesource.com/tools";
sha256 = "1y0k6a6vphd01l2mzdm14aqax4qyslgcbyzl6zkbilj55hfp97y4";
sha256 = "04rpdi52j26szx5kiyfmwad1sg7lfplxrkbwkr3b1kfafh1whgw5";
};
goDeps = ./deps.nix;
modSha256 = "12klgqm2px878lzh05yzj6lr83v7vg0vv2k69pmg6nv1wlsxdlzf";
preConfigure = ''
# Make the builtin tools available here
mkdir -p $bin/bin
mkdir -p $out/bin
eval $(go env | grep GOTOOLDIR)
find $GOTOOLDIR -type f | while read x; do
ln -sv "$x" "$bin/bin"
ln -sv "$x" "$out/bin"
done
export GOTOOLDIR=$bin/bin
export GOTOOLDIR=$out/bin
'';
excludedPackages = "\\("
+ stdenv.lib.concatStringsSep "\\|" ([ "testdata" ] ++ stdenv.lib.optionals (stdenv.lib.versionAtLeast go.meta.branch "1.5") [ "vet" "cover" ])
+ "\\)";
# Set GOTOOLDIR for derivations adding this to buildInputs
postInstall = ''
mkdir -p $out/nix-support
substituteAll ${../../go-modules/tools/setup-hook.sh} $out/nix-support/setup-hook.tmp
cat $out/nix-support/setup-hook.tmp >> $out/nix-support/setup-hook
rm $out/nix-support/setup-hook.tmp
'';
# Do not copy this without a good reason for enabling
# In this case tools is heavily coupled with go itself and embeds paths.
allowGoReference = true;
# Set GOTOOLDIR for derivations adding this to buildInputs
postInstall = ''
mkdir -p $bin/nix-support
substituteAll ${../../go-modules/tools/setup-hook.sh} $bin/nix-support/setup-hook.tmp
cat $bin/nix-support/setup-hook.tmp >> $bin/nix-support/setup-hook
rm $bin/nix-support/setup-hook.tmp
'';
}

View File

@ -1,11 +0,0 @@
[
{
goPackagePath = "golang.org/x/net";
fetch = {
type = "git";
url = "https://go.googlesource.com/net";
rev = "65e2d4e15006aab9813ff8769e768bbf4bb667a0";
sha256 = "0aqcmh0sp723d6hwgrv7pnrs4crns2ngr4x43jd4v985cbn455x7";
};
}
]

View File

@ -0,0 +1,29 @@
{ buildGoModule, fetchFromGitHub, lib }:
buildGoModule rec {
name = "mod-${version}";
version = "0.2.0";
src = fetchFromGitHub {
owner = "marwan-at-work";
repo = "mod";
rev = "v${version}";
sha256 = "1v7qy0q6fb9amcggwzdygl290zhr3w3zgmig2rm5zx91kw973sqc";
};
modSha256 = "0j0c5idgwclszsmay7av9y3lcwfk72ml06nwll3fz404hx8vla6y";
subPackages = [ "cmd/mod" ];
meta = with lib; {
description = "Automated Semantic Import Versioning Upgrades for Go";
longDescription = ''
Command line tool to upgrade/downgrade Semantic Import Versioning in Go
Modules.
'';
homepage = https://github.com/marwan-at-work/mod;
license = licenses.mit;
maintainers = with maintainers; [ kalbasit ];
platforms = platforms.linux ++ platforms.darwin;
};
}

View File

@ -1,19 +1,19 @@
{ buildGoPackage, fetchFromGitHub, lib }:
{ buildGoModule, fetchFromGitHub, lib }:
buildGoPackage rec {
buildGoModule rec {
name = "pet-${version}";
version = "0.3.2";
goPackagePath = "github.com/knqyf263/pet";
version = "0.3.4";
src = fetchFromGitHub {
owner = "knqyf263";
repo = "pet";
rev = "v${version}";
sha256 = "1zv2jfgh5nqd4cwr1ljm5p4rqam7hq3a6asfmhr3lcnp7sz9b8fr";
sha256 = "0m2fzpqxk7hrbxsgqplkg7h2p7gv6s1miymv3gvw0cz039skag0s";
};
goDeps = ./deps.nix;
modSha256 = "04zizcq6x1sshnkbvcy197k6axmjnazi9r7cfvcq7g2ng818y2yb";
subPackages = [ "." ];
meta = with lib; {
description = "Simple command-line snippet manager, written in Go";

View File

@ -1,155 +0,0 @@
[
{
goPackagePath = "github.com/BurntSushi/toml";
fetch = {
type = "git";
url = "https://github.com/BurntSushi/toml";
rev = "a368813c5e648fee92e5f6c30e3944ff9d5e8895";
sha256 = "1sjxs2lwc8jpln80s4rlzp7nprbcljhy5mz4rf9995gq93wqnym5";
};
}
{
goPackagePath = "github.com/briandowns/spinner";
fetch = {
type = "git";
url = "https://github.com/briandowns/spinner";
rev = "5b875a9171af19dbde37e70a8fcbe2ebd7285e05";
sha256 = "0vq78qmg07dm9vnjqz17ca9qml8np7f9vj9igsira7a39xg09ivg";
};
}
{
goPackagePath = "github.com/chzyer/readline";
fetch = {
type = "git";
url = "https://github.com/chzyer/readline";
rev = "2972be24d48e78746da79ba8e24e8b488c9880de";
sha256 = "104q8dazj8yf6b089jjr82fy9h1g80zyyzvp3g8b44a7d8ngjj6r";
};
}
{
goPackagePath = "github.com/fatih/color";
fetch = {
type = "git";
url = "https://github.com/fatih/color";
rev = "2d684516a8861da43017284349b7e303e809ac21";
sha256 = "1fcfmz4wji3gqmmsdx493r7d101s58hwjalqps6hy25nva5pvmfs";
};
}
{
goPackagePath = "github.com/google/go-github";
fetch = {
type = "git";
url = "https://github.com/google/go-github";
rev = "c0b63e2f9bb198baf328c8abf1ddcbe05ff9427e";
sha256 = "1a4skdbzxnyj3irqrmhhj4c9cimga0k5sd0vykjfqj7c8c5bwbd5";
};
}
{
goPackagePath = "github.com/google/go-querystring";
fetch = {
type = "git";
url = "https://github.com/google/go-querystring";
rev = "53e6ce116135b80d037921a7fdd5138cf32d7a8a";
sha256 = "0lkbm067nhmxk66pyjx59d77dbjjzwyi43gdvzyx2f8m1942rq7f";
};
}
{
goPackagePath = "github.com/jroimartin/gocui";
fetch = {
type = "git";
url = "https://github.com/jroimartin/gocui";
rev = "c055c87ae801372cd74a0839b972db4f7697ae5f";
sha256 = "1b1cbjg925l1c5v3ls8amni9716190yzf847cqs9wjnj82z8qa47";
};
}
{
goPackagePath = "github.com/mattn/go-runewidth";
fetch = {
type = "git";
url = "https://github.com/mattn/go-runewidth";
rev = "ce7b0b5c7b45a81508558cd1dba6bb1e4ddb51bb";
sha256 = "0lc39b6xrxv7h3v3y1kgz49cgi5qxwlygs715aam6ba35m48yi7g";
};
}
{
goPackagePath = "github.com/nsf/termbox-go";
fetch = {
type = "git";
url = "https://github.com/nsf/termbox-go";
rev = "5c94acc5e6eb520f1bcd183974e01171cc4c23b3";
sha256 = "1fi8imdgwvlsgifw2qfl3ww0lsrgkfsimkzz7bnrq41nar78s0fw";
};
}
{
goPackagePath = "github.com/pkg/errors";
fetch = {
type = "git";
url = "https://github.com/pkg/errors";
rev = "816c9085562cd7ee03e7f8188a1cfd942858cded";
sha256 = "1ws5crb7c70wdicavl6qr4g03nn6m92zd6wwp9n2ygz5c8rmxh8k";
};
}
{
goPackagePath = "github.com/spf13/cobra";
fetch = {
type = "git";
url = "https://github.com/spf13/cobra";
rev = "a114f312e075f65bf30d6d9a1430113f857e543b";
sha256 = "10lmi5ni06yijxg02fcic5b7ycjkia12yma4a4lz8a56j30wykx1";
};
}
{
goPackagePath = "github.com/spf13/pflag";
fetch = {
type = "git";
url = "https://github.com/spf13/pflag";
rev = "3ebe029320b2676d667ae88da602a5f854788a8a";
sha256 = "11yxs0wqy70wj106fkz8r923yg4ncnc2mbw33v48zmlg4a1rasgp";
};
}
{
goPackagePath = "github.com/xanzy/go-gitlab";
fetch = {
type = "git";
url = "https://github.com/xanzy/go-gitlab";
rev = "696e3cf592c0f71a0fce1934ad500376abe2e12d";
sha256 = "1wjn991i161z4xqply3lxvvjgnisdrbkiadr0h0n01k40hymdx6h";
};
}
{
goPackagePath = "golang.org/x/crypto";
fetch = {
type = "git";
url = "https://go.googlesource.com/crypto";
rev = "a2144134853fc9a27a7b1e3eb4f19f1a76df13c9";
sha256 = "0hjjk6k9dq7zllwsw9icdfbli12ii379q2lajd6l7lyw72wy28by";
};
}
{
goPackagePath = "golang.org/x/net";
fetch = {
type = "git";
url = "https://go.googlesource.com/net";
rev = "a680a1efc54dd51c040b3b5ce4939ea3cf2ea0d1";
sha256 = "018zmn4kmg2mbngcciqal54slc3pl4ry5vlv0bw36fcxvnazxnbp";
};
}
{
goPackagePath = "golang.org/x/oauth2";
fetch = {
type = "git";
url = "https://go.googlesource.com/oauth2";
rev = "ef147856a6ddbb60760db74283d2424e98c87bff";
sha256 = "1q1vm1z40fx1grlrm7az4rln6v5pj9xi5n1cjqg5xgq4dsk9132y";
};
}
{
goPackagePath = "golang.org/x/sys";
fetch = {
type = "git";
url = "https://go.googlesource.com/sys";
rev = "ac767d655b305d4e9612f5f6e33120b9176c4ad4";
sha256 = "1ds29n5lh4j21hmzxz7vk7hv1k6sixc7f0zsdc9xqdg0j7d212zm";
};
}
]

View File

@ -235,6 +235,8 @@ in
pet = callPackage ../development/tools/pet { };
mod = callPackage ../development/tools/mod { };
mht2htm = callPackage ../tools/misc/mht2htm { };
fetchpatch = callPackage ../build-support/fetchpatch { };
@ -13346,15 +13348,21 @@ in
### DEVELOPMENT / GO MODULES
buildGo110Package = callPackage ../development/go-modules/generic {
buildGo110Package = callPackage ../development/go-packages/generic {
go = buildPackages.go_1_10;
};
buildGo111Package = callPackage ../development/go-modules/generic {
buildGo111Package = callPackage ../development/go-packages/generic {
go = buildPackages.go_1_11;
};
buildGoPackage = buildGo111Package;
buildGo111Module = callPackage ../development/go-modules/generic {
go = buildPackages.go_1_11;
};
buildGoModule = buildGo111Module;
go2nix = callPackage ../development/tools/go2nix { };
leaps = callPackage ../development/tools/leaps { };