xin/pkgs/athens.nix

53 lines
1.0 KiB
Nix
Raw Normal View History

2023-09-12 08:44:05 -06:00
{ stdenv
, lib
, buildGoModule
, fetchFromGitHub
, isUnstable
, makeWrapper
, go
, git
, ...
}:
let
2023-07-11 09:12:50 -06:00
vendorHash =
if isUnstable
then ""
else "sha256-7CnkKMZ1so1lflmp4D9EAESR6/u9ys5CTuVOsYetp0I=";
in
2023-09-12 08:44:05 -06:00
with lib;
buildGoModule rec {
pname = "athens";
version = "0.11.0";
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
src = fetchFromGitHub {
owner = "gomods";
repo = pname;
rev = "v${version}";
sha256 = "sha256-hkewZ21ElkoDsbPPiCZNmWu4MBlKTlnrK72/xCX06Sk=";
};
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
doCheck = false;
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
ldflags = [ "-X github.com/gomods/athens/pkg/build.version=${version}" ];
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper go ];
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
proxyVendor = true;
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
subPackages = [ "cmd/proxy" ];
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
vendorSha256 = vendorHash;
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
postInstall = lib.optionalString stdenv.isLinux ''
mv $out/bin/proxy $out/bin/athens
wrapProgram $out/bin/athens --prefix PATH : ${lib.makeBinPath [git]}
'';
2023-07-11 09:12:50 -06:00
2023-09-12 08:44:05 -06:00
meta = {
description = "A Go module datastore and proxy";
homepage = "https://github.com/gomods/athens";
license = licenses.mit;
maintainers = with maintainers; [ qbit ];
};
}