Port go-mtpfs to buildGoPackage

This commit is contained in:
Luca Bruno 2015-02-04 15:53:59 +01:00
parent ee90577704
commit 8fd42c55a9
2 changed files with 41 additions and 51 deletions

View file

@ -1,57 +1,21 @@
{ stdenv, lib, pkgconfig, libmtp, go, fetchFromGitHub }:
{ lib, goPackages, pkgconfig, libmtp, fetchFromGitHub }:
let
goDeps = [
{
root = "github.com/hanwen/go-mtpfs";
src = fetchFromGitHub {
owner = "hanwen";
repo = "go-mtpfs";
rev = "9c2b46050e8ea8574eaec2124867ac7b11e6471d";
sha256 = "0kxi18cb078q4wikfajp3yvp802wzfsfdp431j0dg2jdw8y7gfii";
};
}
{
root = "github.com/hanwen/go-fuse";
src = fetchFromGitHub {
owner = "hanwen";
repo = "go-fuse";
rev = "5d16aa11eef4643de2d91e88a64dcb6138705d58";
sha256 = "0lycfhchn88kbs81ypz8m5jh032fpbv14gldrjirf32wm1d4f8pj";
};
}
{
root = "github.com/hanwen/usb";
src = fetchFromGitHub {
owner = "hanwen";
repo = "usb";
rev = "69aee4530ac705cec7c5344418d982aaf15cf0b1";
sha256 = "01k0c2g395j65vm1w37mmrfkg6nm900khjrrizzpmx8f8yf20dky";
};
}
];
with goPackages;
sources = 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);
buildGoPackage rec {
rev = "9c2b46050e8ea8574eaec2124867ac7b11e6471d";
name = "go-mtpfs-${lib.strings.substring 0 7 rev}";
goPackagePath = "github.com/hanwen/go-mtpfs";
src = fetchFromGitHub {
inherit rev;
owner = "hanwen";
repo = "go-mtpfs";
sha256 = "0kxi18cb078q4wikfajp3yvp802wzfsfdp431j0dg2jdw8y7gfii";
};
in stdenv.mkDerivation rec {
name = "go-mtpfs";
src = sources;
buildInputs = [ go-fuse libmtp usb ];
buildInputs = [ go pkgconfig libmtp ];
installPhase = ''
mkdir -p $out/bin
export GOPATH=$src
go build -v -o $out/bin/go-mtpfs github.com/hanwen/go-mtpfs
'';
subPackages = [ "./" ];
meta = with lib; {
description = "A simple FUSE filesystem for mounting Android devices as a MTP device";

View file

@ -1,7 +1,7 @@
/* This file defines the composition for Go packages. */
{ overrides, stdenv, go, buildGoPackage, git
,fetchgit, fetchhg, fetchurl, fetchFromGitHub }:
{ overrides, stdenv, go, buildGoPackage, git, pkgconfig, libusb
, fetchgit, fetchhg, fetchurl, fetchFromGitHub }:
let self = _self // overrides; _self = with self; {
@ -258,6 +258,19 @@ let self = _self // overrides; _self = with self; {
};
};
go-fuse = buildGoPackage rec {
rev = "5d16aa11eef4643de2d91e88a64dcb6138705d58";
name = "go-fuse-${stdenv.lib.strings.substring 0 7 rev}";
goPackagePath = "github.com/hanwen/go-fuse";
src = fetchFromGitHub {
inherit rev;
owner = "hanwen";
repo = "go-fuse";
sha256 = "0lycfhchn88kbs81ypz8m5jh032fpbv14gldrjirf32wm1d4f8pj";
};
subPackages = [ "fuse" "fuse/nodefs" "fuse/pathfs" ];
};
rcrowley.go-metrics = buildGoPackage rec {
rev = "f770e6f5e91a8770cecee02d5d3f7c00b023b4df";
name = "rcrowley.go-metrics-${stdenv.lib.strings.substring 0 7 rev}";
@ -550,6 +563,19 @@ let self = _self // overrides; _self = with self; {
subPackages = [ "./" ]; # prevent building _demos
};
usb = buildGoPackage rec {
rev = "69aee4530ac705cec7c5344418d982aaf15cf0b1";
name = "usb-${stdenv.lib.strings.substring 0 7 rev}";
goPackagePath = "github.com/hanwen/usb";
src = fetchFromGitHub {
inherit rev;
owner = "hanwen";
repo = "usb";
sha256 = "01k0c2g395j65vm1w37mmrfkg6nm900khjrrizzpmx8f8yf20dky";
};
buildInputs = [ pkgconfig libusb ];
};
websocket = buildGoPackage rec {
rev = "f4076986b69612ecb8bc7ce06d742eda6286200d";
name = "websocket-${stdenv.lib.strings.substring 0 7 rev}";