When using common deps include only specified packages, not all set
This commit is contained in:
parent
bfa32800c3
commit
5c2628a704
@ -1,8 +1,31 @@
|
||||
# This file was generated by go2nix.
|
||||
{ stdenv, lib, goPackages, fetchgit, fetchhg, fetchbzr, fetchsvn }:
|
||||
|
||||
with builtins;
|
||||
with goPackages;
|
||||
|
||||
let
|
||||
depToSrc = jsonDep:
|
||||
{
|
||||
inherit (jsonDep) goPackagePath;
|
||||
src = if jsonDep.fetch.type == "git" then
|
||||
fetchgit {
|
||||
inherit (jsonDep.fetch) url rev sha256;
|
||||
}
|
||||
else {};
|
||||
};
|
||||
|
||||
importGodeps = { depsFile, filterPackages ? [] }:
|
||||
let
|
||||
deps = lib.importJSON depsFile;
|
||||
external = filter (d: d ? include) deps;
|
||||
direct = filter (d: d ? goPackagePath && (length filterPackages == 0 || elem d.goPackagePath filterPackages)) deps;
|
||||
in
|
||||
concatLists (map importGodeps (map (d: { depsFile = ./. + d.include; filterPackages = d.packages; }) external)) ++ (map depToSrc direct);
|
||||
|
||||
godeps = importGodeps { depsFile = ./deps.json; };
|
||||
in
|
||||
|
||||
buildGoPackage rec {
|
||||
name = "gawp-${version}";
|
||||
version = "20160121-${stdenv.lib.strings.substring 0 7 rev}";
|
||||
@ -16,14 +39,5 @@ buildGoPackage rec {
|
||||
sha256 = "0r4bp4w3s9rkmg3cz9jb7d6ngh7vfj31p9kbim6mhilxvmgjk4ly";
|
||||
};
|
||||
|
||||
extraSrcs = map ( jsonDep:
|
||||
{
|
||||
inherit (jsonDep) goPackagePath;
|
||||
src = if jsonDep.fetch.type == "git" then
|
||||
fetchgit {
|
||||
inherit (jsonDep.fetch) url rev sha256;
|
||||
}
|
||||
else {};
|
||||
}
|
||||
) (builtins.fromJSON (builtins.readFile ../../../development/go-modules/libs.json));
|
||||
extraSrcs = godeps;
|
||||
}
|
||||
|
10
pkgs/tools/misc/gawp/deps.json
Normal file
10
pkgs/tools/misc/gawp/deps.json
Normal file
@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"include": "../../../../development/go-modules/libs.json",
|
||||
"packages": [
|
||||
"golang.org/x/sys",
|
||||
"gopkg.in/yaml.v2",
|
||||
"gopkg.in/fsnotify.v1"
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user