From ff344624d612aad36c85aa1aeceda07c8c640ccd Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Sun, 14 Sep 2014 19:07:29 -0400 Subject: [PATCH] add go-repo-root, dependency of go2nix --- .../tools/misc/go-repo-root/default.nix | 33 +++++++++ .../tools/misc/go-repo-root/deps.nix | 67 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 102 insertions(+) create mode 100644 pkgs/development/tools/misc/go-repo-root/default.nix create mode 100644 pkgs/development/tools/misc/go-repo-root/deps.nix diff --git a/pkgs/development/tools/misc/go-repo-root/default.nix b/pkgs/development/tools/misc/go-repo-root/default.nix new file mode 100644 index 000000000000..c4eaf03a3581 --- /dev/null +++ b/pkgs/development/tools/misc/go-repo-root/default.nix @@ -0,0 +1,33 @@ +{ stdenv, lib, go, fetchgit, fetchhg, fetchFromGitHub }: + +let + version = "0.0.1"; +in + +with lib; +stdenv.mkDerivation { + name = "go-repo-root-${version}"; + + src = import ./deps.nix { + inherit stdenv lib fetchhg fetchFromGitHub; + }; + + buildInputs = [ go ]; + + buildPhase = '' + export GOPATH=$src + go build -v -o go-repo-root github.com/cstrahan/go-repo-root + ''; + + installPhase = '' + mkdir -p $out/bin + cp go-repo-root $out/bin + ''; + + meta = with lib; { + homepage = "https://github.com/cstrahan/go-repo-root"; + maintainers = with maintainers; [ cstrahan ]; + license = licenses.mit; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/tools/misc/go-repo-root/deps.nix b/pkgs/development/tools/misc/go-repo-root/deps.nix new file mode 100644 index 000000000000..585e9955ab23 --- /dev/null +++ b/pkgs/development/tools/misc/go-repo-root/deps.nix @@ -0,0 +1,67 @@ +{ stdenv, lib, fetchFromGitHub, fetchhg }: + +let + goDeps = [ + { + root = "code.google.com/p/go.net"; + src = fetchhg { + url = "http://code.google.com/p/go.net"; + rev = "ad01a6fcc8a19d3a4478c836895ffe883bd2ceab"; + sha256 = "0s0aa8hxrpggn6wwx4x591k6abvawrmhsk8ji327pgj08fdy3ahq"; + }; + } + { + root = "code.google.com/p/go.text"; + src = fetchhg { + url = "http://code.google.com/p/go.text"; + rev = "12288f41f508af9490f03a9780afa295c9b0a063"; + sha256 = "17kr0h79pznb3nn5znbh1d7dinmqjwvg5iqqk4l05569q50gqwww"; + }; + } + { + root = "code.google.com/p/go.tools"; + src = fetchhg { + url = "http://code.google.com/p/go.tools"; + rev = "140fcaadc5860b1a014ec69fdeec807fe3b787e8"; + sha256 = "1vgz4kxy0p56qh6pfbs2c68156hakgx4cmrci9jbg7lnrdaz4y56"; + }; + } + { + root = "code.google.com/p/goauth2"; + src = fetchhg { + url = "http://code.google.com/p/goauth2"; + rev = "afe77d958c701557ec5dc56f6936fcc194d15520"; + sha256 = "0xgkgcb97hv2rvzvh21rvydq5cc83j7sdsdb1chrymq8k7l4dzc1"; + }; + } + { + root = "code.google.com/p/google-api-go-client"; + src = fetchhg { + url = "http://code.google.com/p/google-api-go-client"; + rev = "e1c259484b495133836706f46319f5897f1e9bf6"; + sha256 = "051dqhjhp3bz2xp7lv9v60xlmphbxj1vyc46wg8v74yjvqvsiwzd"; + }; + } + { + root = "github.com/cstrahan/go-repo-root"; + src = fetchFromGitHub { + owner = "cstrahan"; + repo = "go-repo-root"; + rev = "90041e5c7dc634651549f96814a452f4e0e680f9"; + sha256 = "1rlzp8kjv0a3dnfhyqcggny0ad648j5csr2x0siq5prahlp48mg4"; + }; + } + ]; + +in + +stdenv.mkDerivation rec { + name = "go-deps"; + + buildCommand = + lib.concatStrings + (map (dep: '' + mkdir -p $out/src/`dirname ${dep.root}` + ln -s ${dep.src} $out/src/${dep.root} + '') goDeps); +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 673439260d22..4beae3a46d5d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3106,6 +3106,8 @@ let go = go_1_3; + go-repo-root = callPackage ../development/tools/misc/go-repo-root { }; + gox = callPackage ../development/compilers/go/gox.nix { }; gprolog = callPackage ../development/compilers/gprolog { };