Merge pull request #57080 from kalbasit/nixpkgs_create-build-go-module
buildGoModule: building Go binaries in two phases
This commit is contained in:
@@ -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
|
||||
'';
|
||||
}
|
||||
|
||||
Generated
-11
@@ -1,11 +0,0 @@
|
||||
[
|
||||
{
|
||||
goPackagePath = "golang.org/x/net";
|
||||
fetch = {
|
||||
type = "git";
|
||||
url = "https://go.googlesource.com/net";
|
||||
rev = "65e2d4e15006aab9813ff8769e768bbf4bb667a0";
|
||||
sha256 = "0aqcmh0sp723d6hwgrv7pnrs4crns2ngr4x43jd4v985cbn455x7";
|
||||
};
|
||||
}
|
||||
]
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
Generated
-155
@@ -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";
|
||||
};
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user