1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/servers/nosql/influxdb/gdm2nix.rb
Kamil Chmielewski 914e0e594c buildGoPackage: deps.json -> deps.nix in NIXON
https://github.com/NixOS/nixpkgs/pull/17254#issuecomment-245295541

* update docs to describe `deps.nix`
* include goDeps in nix-shell GOPATH
* NixOS 16.09 rel notes about replacing goPackages
2016-09-16 00:04:55 +01:00

40 lines
942 B
Ruby
Executable file

#!/usr/bin/env ruby
#
#
require "json"
redirects = {
"collectd.org" => "github.com/collectd/go-collectd",
"git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git" => "github.com/eclipse/paho.mqtt.golang",
"golang.org/x/net" => "github.com/golang/net",
"golang.org/x/crypto" => "github.com/golang/crypto",
"golang.org/x/text" => "github.com/golang/text",
"golang.org/x/tools" => "github.com/golang/tools",
"gopkg.in/fatih/pool.v2" => "github.com/fatih/pool",
}
godeps = ARGV[0] || "Godeps"
deps = File.read(godeps).lines.map do |line|
(name, rev) = line.split(" ")
host = redirects.fetch(name, name)
url = "https://#{host}.git"
xxx = JSON.load(`nix-prefetch-git #{url} #{rev}`)
{
goPackagePath: name,
fetch: {
type: "git",
url: url,
rev: rev,
sha256: xxx['sha256'],
}
}
end
#TODO: move to deps.nix in NIXON format
File.write("deps.json", JSON.pretty_generate(deps))