buildGoPackage: also support pname

Following python-modules and stdenv.mkDerivation.
Hopefully zero rebuilds.

Motivation: https://github.com/NixOS/nixpkgs/pull/52409
This commit is contained in:
Jörg Thalheim 2018-12-18 03:55:02 +01:00
parent b0ccd8be8e
commit b4593b4629
No known key found for this signature in database
GPG Key ID: CA4106B8D7CC79FA

View File

@ -1,7 +1,10 @@
{ go, govers, lib, fetchgit, fetchhg, fetchbzr, rsync { go, govers, lib, fetchgit, fetchhg, fetchbzr, rsync
, removeReferencesTo, fetchFromGitHub, stdenv }: , removeReferencesTo, fetchFromGitHub, stdenv }:
{ name, buildInputs ? [], nativeBuildInputs ? [], passthru ? {}, preFixup ? "" { buildInputs ? []
, nativeBuildInputs ? []
, passthru ? {}
, preFixup ? ""
, shellHook ? "" , shellHook ? ""
# We want parallel builds by default # We want parallel builds by default
@ -34,7 +37,6 @@
, meta ? {}, ... } @ args': , meta ? {}, ... } @ args':
if disabled then throw "${name} not supported for go ${go.meta.branch}" else
with builtins; with builtins;
@ -72,12 +74,9 @@ let
goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs goPath = if goDeps != null then importGodeps { depsFile = goDeps; } ++ extraSrcs
else extraSrcs; else extraSrcs;
in package = go.stdenv.mkDerivation (
go.stdenv.mkDerivation (
(builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // { (builtins.removeAttrs args [ "goPackageAliases" "disabled" ]) // {
inherit name;
nativeBuildInputs = [ removeReferencesTo go ] nativeBuildInputs = [ removeReferencesTo go ]
++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs; ++ (lib.optional (!dontRenameImports) govers) ++ nativeBuildInputs;
buildInputs = buildInputs; buildInputs = buildInputs;
@ -238,4 +237,8 @@ go.stdenv.mkDerivation (
maintainers = (meta.maintainers or []) ++ maintainers = (meta.maintainers or []) ++
[ lib.maintainers.ehmry lib.maintainers.lethalman ]; [ lib.maintainers.ehmry lib.maintainers.lethalman ];
}; };
}) });
in if disabled then
throw "${package.name} not supported for go ${go.meta.branch}"
else
package