diff --git a/pkgs/tools/text/peco/default.nix b/pkgs/tools/text/peco/default.nix index a58cb87d1db1..9f181094ea00 100644 --- a/pkgs/tools/text/peco/default.nix +++ b/pkgs/tools/text/peco/default.nix @@ -1,56 +1,20 @@ -{ stdenv, go, fetchgit }: +{ stdenv, buildGoPackage, fetchFromGitHub }: -let - go-flags = fetchgit { - url = "git://github.com/jessevdk/go-flags"; - rev = "ef51ed2000ee1721c7153e958511907b844b4a9c"; - sha256 = "1abzc7ksglicaz6g6nry006vwvflsidvyzyig85pi3p852z6sc2j"; - }; - go-runewidth = fetchgit { - url = "git://github.com/mattn/go-runewidth"; - rev = "63c378b851290989b19ca955468386485f118c65"; - sha256 = "1z5mhfrpqdssn3603vwd95w69z28igwq96lh7b9rrdcx440i822d"; - }; - termbox-go = fetchgit { - url = "git://github.com/nsf/termbox-go"; - rev = "bb19a81afd4bc2729799d1fedb19f7bd7ee284cf"; - sha256 = "1zc8pb594l16yipis6xg2ra84bg315p63wqxa5abyam1y0333sn0"; - }; -in stdenv.mkDerivation rec { +buildGoPackage rec { name = "peco-${version}"; - version = "0.2.10"; + version = "0.5.1"; - src = fetchgit { - url = "git://github.com/peco/peco"; - rev = "4952013023ae1d92c10d826e6970c5a68959678d"; - sha256 = "15blxy6a9ph6hm5wn14p025qidbspjy6hhmp4zbbgpxx2l1x8fpg"; + goPackagePath = "github.com/peco/peco"; + subPackages = [ "cmd/peco" ]; + + src = fetchFromGitHub { + owner = "peco"; + repo = "peco"; + rev = "v${version}"; + sha256 = "0jnlpr3nxx8xmjb6w4jlwshzz0p9hlww9919qbkm66afv16k0vm8"; }; - buildInputs = [ go ]; - - sourceRoot = "."; - - buildPhase = '' - mkdir -p src/github.com/jessevdk/go-flags/ - ln -s ${go-flags}/* src/github.com/jessevdk/go-flags - - mkdir -p src/github.com/mattn/go-runewidth/ - ln -s ${go-runewidth}/* src/github.com/mattn/go-runewidth - - mkdir -p src/github.com/nsf/termbox-go/ - ln -s ${termbox-go}/* src/github.com/nsf/termbox-go - - mkdir -p src/github.com/peco/peco - ln -s ${src}/* src/github.com/peco/peco - - export GOPATH=$PWD - go build -v -o peco src/github.com/peco/peco/cmd/peco/peco.go - ''; # */ - - installPhase = '' - ensureDir $out/bin - cp peco $out/bin - ''; + goDeps = ./deps.nix; meta = with stdenv.lib; { description = "Simplistic interactive filtering tool"; diff --git a/pkgs/tools/text/peco/deps.nix b/pkgs/tools/text/peco/deps.nix new file mode 100644 index 000000000000..1b884ef995e8 --- /dev/null +++ b/pkgs/tools/text/peco/deps.nix @@ -0,0 +1,57 @@ +# This file was generated by https://github.com/kamilchm/go2nix v1.2.1 +[ + { + goPackagePath = "github.com/google/btree"; + fetch = { + type = "git"; + url = "https://github.com/google/btree"; + rev = "0c3044bc8bada22db67b93f5760fe3f05d6a5c25"; + sha256 = "05rdnf2c9r0yicg17zsq58i0sm32p0lk8zdnb7nhr0v5hqldvps4"; + }; + } + { + goPackagePath = "github.com/jessevdk/go-flags"; + fetch = { + type = "git"; + url = "https://github.com/jessevdk/go-flags"; + rev = "8bc97d602c3bfeb5fc6fc9b5a9c898f245495637"; + sha256 = "1h3il3ycgd54flbyqys4hm4gzx1lyn5ja1k79f2y7zbs6y0mf1lz"; + }; + } + { + goPackagePath = "github.com/lestrrat/go-pdebug"; + fetch = { + type = "git"; + url = "https://github.com/lestrrat/go-pdebug"; + rev = "2e6eaaa5717f81bda41d27070d3c966f40a1e75f"; + sha256 = "05dx1f1yln47nazyi50zix82xbnyva3hily4gh5gaz021h01npax"; + }; + } + { + goPackagePath = "github.com/mattn/go-runewidth"; + fetch = { + type = "git"; + url = "https://github.com/mattn/go-runewidth"; + rev = "737072b4e32b7a5018b4a7125da8d12de90e8045"; + sha256 = "09ni8bmj6p2b774bdh6mfcxl03bh5sqk860z03xpb6hv6yfxqkjm"; + }; + } + { + goPackagePath = "github.com/nsf/termbox-go"; + fetch = { + type = "git"; + url = "https://github.com/nsf/termbox-go"; + rev = "abe82ce5fb7a42fbd6784a5ceb71aff977e09ed8"; + sha256 = "156i8apkga8b3272kjhapyqwspgcfkrr9kpqwc5lii43k4swghpv"; + }; + } + { + goPackagePath = "github.com/pkg/errors"; + fetch = { + type = "git"; + url = "https://github.com/pkg/errors"; + rev = "248dadf4e9068a0b3e79f02ed0a610d935de5302"; + sha256 = "03l80r0i9bxl0vz363w62k4a8apzglgbrz6viwym3044sxkl1qks"; + }; + } +]